Skip to content

Instantly share code, notes, and snippets.

@rockydd
Created May 10, 2017 03:31
Show Gist options
  • Save rockydd/6db4a241f7d516d170c5a4c0031af2c7 to your computer and use it in GitHub Desktop.
Save rockydd/6db4a241f7d516d170c5a4c0031af2c7 to your computer and use it in GitHub Desktop.
UMD
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD
define(['jquery'], factory);
} else if (typeof exports === 'object') {
// Node, CommonJS-like
module.exports = factory(require('jquery'));
} else {
// Browser globals (root is window)
root.returnExports = factory(root.jQuery);
}
}(this, function ($) {
// methods
function myFunc(){};
// exposed public method
return myFunc;
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment