Created
September 3, 2014 20:44
-
-
Save gcpantazis/4d5bf949c3f910bb00b6 to your computer and use it in GitHub Desktop.
Component / plugin definition pattern
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
(function() { | |
var MyModule = function() { | |
// ... | |
} | |
// Browserify / CommonJS | |
if (typeof module === "object" && typeof module.exports === "object") { | |
module.exports = MyModule; | |
// RequireJS / AMD | |
} else if (typeof define === "function" && define.amd) { | |
define("MyModule", [], MyModule); | |
// Old Skool | |
} else { | |
window.MyModule = MyModule; | |
} | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment