-
Recent Posts
Meta
Neyric.com
Categories
Archives
Monthly Archives: February 2007
Singleton pattern in Javascript
If you’d like to create just one instance of a Class, you’d better use this singleton pattern: var singleton = function() { /* Private variables */ var privateVariable; /* Private methods */ function privateFunction(x) { // do something here… } … Continue reading
Tagged javascript, pattern, singleton
1 Comment
How to set a timer within an object in Javascript
UPDATE: I don’t recommend this method anymore: it’s not a good idea to add functions to Object.prototype. Prefer adding this function to your object prototypes. Here’s a useful method given by Douglas Crockford that can be added to Object.prototype : … Continue reading
Tagged setTimeout, timer
Leave a comment