Created
July 8, 2013 20:44
-
-
Save cybrown/5952339 to your computer and use it in GitHub Desktop.
Require.js, nodejs and vanilla module definition (jQuery like).
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, undefined) { // undefined as an undefined parameter | |
| 'use strict'; | |
| var Module = null; // module definition here | |
| if (typeof module === "object" && module && typeof module.exports === "object") { | |
| module.exports = Module; // commonjs module (ndoejs...) | |
| } else if (typeof define === "function" && define.amd) { | |
| define([], function () {return Module;}); // amd module (requirejs...) | |
| } else if (typeof window === "object" && typeof window.document === "object") { | |
| window.Module = Module; // Browser global namespace | |
| } | |
| })(window); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment