Last active
October 11, 2015 21:38
-
-
Save pazguille/3923164 to your computer and use it in GitHub Desktop.
Exports your library - support AMD / CommonJS
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
// @see http://addyosmani.com/writing-modular-js/ | |
// library was previously defined | |
// AMD suppport | |
if (typeof window.define === 'function' && window.define.amd !== undefined) { | |
window.define('library', [], function () { | |
return library; | |
}); | |
// CommonJS suppport | |
} else if (typeof module !== 'undefined' && module.exports !== undefined) { | |
module.exports = library; | |
// Default | |
} else { | |
window.library = library; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment