Created
October 19, 2010 15:50
-
-
Save dsimard/634414 to your computer and use it in GitHub Desktop.
Real javascript singleton
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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