Last active
January 18, 2022 13:09
-
-
Save rishabhshuklax/aa4b150e42d5a0fc0c9e4eb4921fdb72 to your computer and use it in GitHub Desktop.
WazirX Notification Service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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