Created
August 10, 2021 10:08
-
-
Save anasnakawa/384941555f564e0c1b51980b30553c18 to your computer and use it in GitHub Desktop.
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
var elementToCheck; | |
var DELAY = 200; | |
function checker() { | |
elementToCheck = document.querySelector('#spoAppComponent'); | |
if(elementToCheck != null) { | |
putBreakPoint(); | |
return; | |
} | |
// otherwise, keep listening | |
setTimeout(checker, DELAY) | |
} | |
function putBreakPoint() { | |
console.log('>>>>>> listening to breakpoint right now') | |
var fnRemoveSelf = elementToCheck.remove; | |
var fnRemoveParent = elementToCheck.parentElement.removeChild; | |
elementToCheck.parentElement.removeChild = function() { | |
debugger; | |
return fnRemoveParent.apply(this, arguments); | |
} | |
elementToCheck.remove = function() { | |
debugger; | |
return fnRemoveSelf.apply(this, arguments); | |
} | |
} | |
checker(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment