Last active
August 29, 2015 13:57
-
-
Save regou/9504368 to your computer and use it in GitHub Desktop.
通用模块写法
This file contains hidden or 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
(function(window, module, define) { | |
'use strict'; | |
var context=function(require){ | |
//edit here | |
return moduleOnto; | |
}; | |
if(module){module.exports=context(require);}else if(define){define(context);}else{ window.moduleOnto=context();} | |
})(typeof window !== "undefined" ? window : {}, typeof module !== "undefined" && module.exports? module:null, typeof define === 'function'?define:null ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
兼容 nodejs seajs Browserify RequireJS 和 script标签;
script标签下不支持内部require模块。