Skip to content

Commit

Permalink
update approach for plan check
Browse files Browse the repository at this point in the history
  • Loading branch information
notshivansh committed Dec 30, 2024
1 parent d8fe3b6 commit a180776
Showing 1 changed file with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,17 @@ function Billing() {
}

if (window.PLAN_TYPE && window.PLAN_TYPE.length > 0) {
const observer = new MutationObserver((mutationsList) => {
for (const mutation of mutationsList) {
const elements = document.querySelectorAll('.stigg-subscription-plan-name');
if (elements.length > 0) {
elements.forEach(element => {
element.textContent = window.PLAN_TYPE;
});
observer.disconnect(); // Stop observing once the element is found
}
const checkForElement = () => {
const elements = document.querySelectorAll('.stigg-subscription-plan-name');
if (elements.length > 0) {
elements.forEach(element => {
element.textContent = window.PLAN_TYPE;
});
} else {
setTimeout(() => checkForElement(), 500);
}
});
observer.observe(document.body, { childList: true, subtree: true });
return () => observer.disconnect(); // Cleanup on unmount
};
checkForElement();
}
})

Expand Down

0 comments on commit a180776

Please sign in to comment.