Skip to content

Instantly share code, notes, and snippets.

@agusputra
Created March 16, 2022 11:37
Show Gist options
  • Save agusputra/e8b7ad3a421057411d96f1219f66c58c to your computer and use it in GitHub Desktop.
Save agusputra/e8b7ad3a421057411d96f1219f66c58c to your computer and use it in GitHub Desktop.
(() => {
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