Last active
August 29, 2015 14:15
-
-
Save 255kb/60f632a8adecf14c7cb5 to your computer and use it in GitHub Desktop.
Javascript library pattern (instantiable object)
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
| /* Replace 'library' by your library name */ | |
| (function(root, factory) { | |
| if (typeof define === 'function' && define.amd) { | |
| //AMD | |
| define([], factory); | |
| } else if (typeof module !== 'undefined' && module.exports) { | |
| //Node.js or CommonJS | |
| module.exports = factory(); | |
| } else { | |
| //Global | |
| root.library = factory(); | |
| } | |
| }(this, function() { | |
| 'use strict'; | |
| function library(){ | |
| }; | |
| library.prototype = { | |
| }; | |
| return library; | |
| })); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment