Last active
May 1, 2017 09:19
-
-
Save peterhartree/3e16db565e591f08a7b5a4c89b003038 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 waitTime = 0; | |
var maximumWaitTime = 1000 * 5; // 5 seconds | |
waitForSleeknoteToLoad(waitTime, maximumWaitTime); | |
function waitForSleeknoteToLoad(waitTime, maximumWaitTime) { | |
if(typeof SleekNote !== 'undefined' && typeof SleekNote.triggerOnclick === 'function'){ | |
$(document).trigger('SleeknoteLoaded'); | |
} | |
else { | |
waitTime += 1000; | |
if(waitTime < maximumWaitTime) { | |
setTimeout(function() { | |
waitForSleeknoteToLoad(waitTime, maximumWaitTime); | |
}, 1000); | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment