Sunday, February 17, 2013

Singleton_1


/* Singleton as an Object Literal. */
MyNamespace.Singleton = {};

You will now use a function, executed immediately, to provide the same thing:

/* Singleton with Private Members, step 1. */
MyNamespace.Singleton = function() {
    return {};
}();


No comments:

Post a Comment