Skip to content

Instantly share code, notes, and snippets.

@forforf
Created September 12, 2013 13:32
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 forforf/6537377 to your computer and use it in GitHub Desktop.
Save forforf/6537377 to your computer and use it in GitHub Desktop.
Javascript Library Template
window.FooFoo = (function () {
//Private Functions & Classes
function notExposed () { /* internal library logic */ }
//Public Exposed Object
var FooFoo = {
//publicly available as FooFoo.static
static: "Some static value",
doSomething: function () { ... publicly available as FooFoo.doSomething ... }
};
//Initialization function (optional)
function init () { /* do initial setup */}
return FooFoo;
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment