Skip to content

Instantly share code, notes, and snippets.

@pazguille
Last active October 11, 2015 21:38
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pazguille/3923164 to your computer and use it in GitHub Desktop.
Save pazguille/3923164 to your computer and use it in GitHub Desktop.
Exports your library - support AMD / CommonJS
// @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