Last active
August 12, 2020 08:12
-
-
Save Strongground/d74b43bb5eb219e7876d723124132da9 to your computer and use it in GitHub Desktop.
Defer method to deferred loading of any method requiring jQuery on root level of webpages
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 defer(method) { | |
if (window.jQuery) { | |
method() | |
} else { | |
setTimeout(function() { defer(method) }, 50) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment