Created
March 28, 2024 04:12
-
-
Save aliboy08/5744b70e43926445d749b3a5f10a0f6d to your computer and use it in GitHub Desktop.
Script ready checker
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
function script_ready_check(script, cb, interval, limit){ | |
var time = 0; | |
var check = setInterval(function(){ | |
if( typeof script !== 'undefined' ) { | |
clearInterval(check); | |
cb(); | |
} | |
time += interval; | |
if( time >= limit ) { | |
clearInterval(check); | |
} | |
}, interval); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment