Skip to content

Instantly share code, notes, and snippets.

@lpaulger
Last active Apr 18, 2016
Embed
What would you like to do?
example UMD module
;(function(root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery'], factory);
} else if (typeof exports === 'object') {
module.exports = factory(require('jquery'));
} else {
root.MyModule = factory(root.jQuery);
}
}(this, function($) {
'use strict'
var MyModule = {
foo: function() {
//example with external dependency
return $.doSomething();
},
bar: function() {
//content
}
}
return MyModule;
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment