Skip to content

Instantly share code, notes, and snippets.

@ismyrnow
Created February 18, 2012 21:45
Show Gist options
  • Select an option

  • Save ismyrnow/1861094 to your computer and use it in GitHub Desktop.

Select an option

Save ismyrnow/1861094 to your computer and use it in GitHub Desktop.
Creating an unobtrusive JS object
(function (window, undefined) {
var privateVariable = null;
var exampleObject = {
publicMethodOne: function () {},
publicMethodTwo: function () {}
};
// Expose exampleObject to the global object
window.exampleObject = exampleObject;
})(window);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment