Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@gatlin
Last active March 9, 2016 17:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gatlin/f72739ca62692bede397 to your computer and use it in GitHub Desktop.
Save gatlin/f72739ca62692bede397 to your computer and use it in GitHub Desktop.
/**
* ECMAScript module boilerplate
*
* (c) 2016 Gatlin Johnson <gatlin@niltag.net>
* with significant credit to github user @cwmyers
*
* Follow this template and your module will be compatible with browsers or any
* number of sophisticated ES dependency systems.
*
* INSTRUCTIONS
*
* Write your definitions between MODULE BEGIN and MODULE END. Anything you
* wish to export publicly should be added to the `module` object.
*/
(function(root, factory) {
if (typeof exports === 'object') {
module.exports = factory(root);
} else
if (typeof define === 'function' && define.amd) {
define(factory);
} else {
root = factory(root);
}
}(this, function(module) {
//////////
// MODULE BEGIN
//////////
var private_data = "this is not exported";
module.foo = "this will be exported";
//////////
// MODULE END
//////////
return module;
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment