Skip to content

Commit

Permalink
Observe ad
Browse files Browse the repository at this point in the history
  • Loading branch information
bonny committed May 17, 2024
1 parent 2b480d7 commit c34a33a
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion resources/views/components/events-map.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,6 @@ class EventsMap {
return;
}
// Options for the observer (which mutations to observe)
const config = {
attributes: false,
Expand All @@ -346,6 +345,20 @@ class EventsMap {
// Check status of ad.
console.log('dataset: ', node.dataset);
console.log('dataset stringified: ', JSON.stringify(node.dataset));
// Keep track of attribute changes on this ad.
const adObserver = new MutationObserver((adMutationsList, adObserver) => {
for (const mutation of mutationsList) {
if (mutation.type === "attributes") {
console.log("An attribute was modified on the ad: ", mutation);
console.log("Ad status: ", node.dataset);
}
}
});
adObserver.observe(node, {
attributes: true,
//attributeFilter: ['data-ad-status'],
});
}
}
}
Expand Down

0 comments on commit c34a33a

Please sign in to comment.