Created
July 16, 2015 16:22
-
-
Save ecasilla/ae48bb294d23e1cb5c48 to your computer and use it in GitHub Desktop.
module definition in all envs
This file contains 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
if (typeof module !== 'undefined' && module.exports) { | |
module.exports = myModule; | |
} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd){ | |
// AMD. Register as an anonymous module. | |
define(function () { | |
return myModule; | |
}); | |
} else { | |
window.myModule = myModule; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment