OMD的源码
!(function(dependencies, factory) {
//amd || cmd
if (typeof define == 'function' && (define.cmd || define.amd)) {
define(dependencies, function() {
return factory();
});
} else {
var ex = factory();
//CommonJs Nodejs
if (typeof module !== "undefined" && typeof exports === 'object') {
module.exports = ex;
} else {
for (var i in ex) {
window[i] = ex[i];
}
}
}
})(['jquery'], function() {
//your code begin
});
https://www.talkingcoder.com/article/6265868891275722752