Created
March 16, 2022 11:37
-
-
Save agusputra/e8b7ad3a421057411d96f1219f66c58c to your computer and use it in GitHub Desktop.
This file contains hidden or 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 execute = () => { | |
jQuery(($) => { | |
/// | |
// Do something | |
/// | |
}); | |
}; | |
const executeIf = (globalProp, execute) => () => { | |
if (window[globalProp]) { | |
execute(); | |
console.log('Execute: ', execute) | |
} else { | |
setTimeout(executeIf(globalProp, execute), 500); | |
} | |
}; | |
executeIf('jQuery', execute)(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment