Last active
March 4, 2020 07:10
-
-
Save linclark/2457d5e9d3105f759ebc 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
// This function is called immediately. The second function is passed in | |
// as the factory parameter to this function. | |
(function (factory) { | |
// If there is a variable named module and it has an exports property, | |
// then we're working in a Node-like environment. Use require to load | |
// the jQuery object that the module system is using and pass it in. | |
if(typeof module === "object" && typeof module.exports === "object") { | |
factory(require("jquery"), window, document); | |
} | |
// Otherwise, we're working in a browser, so just pass in the global | |
// jQuery object. | |
else { | |
factory(jQuery, window, document); | |
} | |
}(function($, window, document, undefined) { | |
// This code will receive whatever jQuery object was passed in from | |
// the function above and will attach the tipso plugin to it. | |
})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What about AMD?
Can the gist be rewritten to:
?