Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trigger the event handler when an ancestor gets deleted #74

Closed
jckautzmann opened this issue May 6, 2020 · 0 comments · Fixed by #75
Closed

Trigger the event handler when an ancestor gets deleted #74

jckautzmann opened this issue May 6, 2020 · 0 comments · Fixed by #75
Milestone

Comments

@jckautzmann
Copy link
Contributor

jckautzmann commented May 6, 2020

Let's consider the following scenario:

// Store `carousel1`:
window.adobeDataLayer.push({
  component: {
    carousel: {
      carousel1: {
        id: '/content/mysite/en/home/jcr:content/root/carousel1',
        shownItems: [
          'item1', 'item2'
        ]
      }
    }
  }
});

// Remove `carousel`:
window.adobeDataLayer.push({
  component: {
    carousel: null
  }
});

// Define an event listener specific to the `carousel1` object:
const callback = function(event) {
  console.log(event);
};
window.adobeDataLayer.addEventListener('adobeDataLayer:change', callback, {path: 'component.carousel.carousel1'});

Expected: both change events should be logged: one for storing carousel1, one for removing carousel (which is an ancestor of carousel1).

This behaviour should happen for any kind of events (data layer specific and custom ones).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants