Skip to content

Instantly share code, notes, and snippets.

@dsimard
Created October 19, 2010 15:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dsimard/634414 to your computer and use it in GitHub Desktop.
Save dsimard/634414 to your computer and use it in GitHub Desktop.
Real javascript singleton
var myApplication = {};
myApplication.instance = (function() {
var i = {
msg : "Hello world!",
hello : function() {
alert(i.msg);
}
};
return i;
})();
myApplication.instance.hello();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment