Last active
September 30, 2020 19:12
-
-
Save hitGovernor/dc3e7120830a9feaea16c6840715d36c 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
// default the flag to false (it gets set to true in registerPostTrackCallback) | |
var flag = false; | |
// wait for flag=true (set in registerPostTrackCallback) to fire the s.tl() call | |
var waitForFlag = setInterval(function() { | |
if(flag) { | |
console.log("fire s.tl() here"); | |
clearInterval(waitForFlag); | |
} | |
}, 50); | |
// this is a placeholder for the s.registerPostTrackCallback)() logic; | |
// consider checking for the call type (make sure it's not an s.tl() call) before | |
// setting flag=true | |
function pretendThisIsRegisterPostTrackCallback() { | |
console.log("in registerPostTrackCallback; setting flag=true"); | |
flag = true; | |
} | |
// this is just a delay to fire the s.t() call after a couple of seconds; | |
// in your scenario, this would be the actual s.t() call | |
setTimeout(function() { | |
console.log("fire s.t() here"); | |
pretendThisIsRegisterPostTrackCallback(); | |
}, 2000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment