Created
February 3, 2011 09:48
-
-
Save roy/809280 to your computer and use it in GitHub Desktop.
Correct way of doing initializing one instance
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 TestClass = Class.create({ | |
initialize: function(){ | |
//fancy stuff here | |
} | |
}); | |
document.observe("dom:loaded", function(){ new TestClass(); }); | |
// or | |
(function(){ | |
var TestClass = Class.create({ | |
initialize: function(){ | |
//fancy stuff here | |
} | |
}); | |
new TestClass(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment