Created
July 13, 2016 13:17
-
-
Save xuanfeng/19b8832d2f69081402b6c6769042e4b0 to your computer and use it in GitHub Desktop.
define module
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
// js库模版 | |
// 可直接被引用或者AMD、CMD方式加载 | |
;(function(root, factory) { | |
if (typeof module !== 'undefined' && module.exports) {// CommonJS | |
module.exports = factory(); | |
} else if (typeof define === 'function' && define.amd) {// AMD / RequireJS | |
define(factory); | |
} else { | |
root.Promise = factory.call(root); | |
} | |
}(this, function() { | |
'use strict'; | |
function Promise(resolver) { | |
console.log('promise'); | |
return this; | |
} | |
Promise.prototype.then = function(resolve, reject) {} | |
return Promise; | |
})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment