Created
October 1, 2016 10:19
-
-
Save ali-master/f1aebcb7987d383b7111126121d658a6 to your computer and use it in GitHub Desktop.
Export Function in AMD And CommonJS
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(global, factory) { | |
/*global define: false*/ | |
/*global exports: true*/ | |
if (typeof exports === 'object' && exports) { | |
factory(exports); // CommonJS | |
} else if (typeof define === 'function' && define.amd) { | |
define(['exports'], factory); // AMD | |
} else { | |
factory(global); // <script> | |
} | |
} (this, function(global) { | |
// your code.. | |
global === window // return true | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment