Skip to content

Instantly share code, notes, and snippets.

@ecasilla
Created July 16, 2015 16:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ecasilla/ae48bb294d23e1cb5c48 to your computer and use it in GitHub Desktop.
Save ecasilla/ae48bb294d23e1cb5c48 to your computer and use it in GitHub Desktop.
module definition in all envs
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