jQuery-store
jQuery-store copied to clipboard
Initializing $.store twice adds duplicate en/decoders
Running the following code:
s = new $.store();
s.set('test', {"a":1});
console.log('Get 1', s.get('test'));
s = new $.store();
console.log('Get 2', s.get('test'));
results in
Get 1 Object
a: 1
SyntaxError: Unexpected token o
This happens because .encoders and .decoders are part of the prototype, and thus globally modified every time new $.store
is called.
This is an issue because I am using this in a single page application, and use it in just one model where it's needed (instead of storing a global reference and only initializing once).