Skip to content

Instantly share code, notes, and snippets.

@rishabhshuklax
Last active January 18, 2022 13:09
Show Gist options
  • Save rishabhshuklax/aa4b150e42d5a0fc0c9e4eb4921fdb72 to your computer and use it in GitHub Desktop.
Save rishabhshuklax/aa4b150e42d5a0fc0c9e4eb4921fdb72 to your computer and use it in GitHub Desktop.
WazirX Notification Service
const notifyMe = (className, limitArray) => {
let target = $(`.${className}`),
config;
const observer = new MutationObserver(function() {
let value = target.innerText;
value = parseInt(value.split('.')[0].slice(1).replace(/,/g, ''), 10);
if (value < limitArray[1] && value > limitArray[0]) {
const notification = new Notification('OK!!', { body: '!!!!!!!!!!!' });
}
});
// configuration of the observer:
config = { attributes: true, childList: true, characterData: true };
// pass in the target node, as well as the observer options
observer.observe(target, config);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment