Skip to content

Instantly share code, notes, and snippets.

// 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