Static objects are those that cannot be instantiated; they exist as a singleton. The benefits are mostly performance related; however, static object method calls are significantly faster than both module pattern and prototypal method calls.
The only thing that has to be worked out is how to extend the localRedis object with additional methods and APIs.
The implementation could resemble this:
(function (window) {
/* private methods here */
var storage = window.localStorage,
localRedis = {
get: function (key) {},
set: function (key, value) {},
/* more api commands */
};
window.localRedis = localRedis;
})(window);
Static objects are those that cannot be instantiated; they exist as a singleton. The benefits are mostly performance related; however, static object method calls are significantly faster than both module pattern and prototypal method calls.
The only thing that has to be worked out is how to extend the
localRedis
object with additional methods and APIs.The implementation could resemble this: