marcuswestin / store.js

Cross-browser storage for all use cases, used across the web.
MIT License
14.02k stars 1.33k forks source link

Expire plugin doesn't factor custom namespaces #215

Closed ingro closed 7 years ago

ingro commented 7 years ago

Hello! I'm trying to use the new expire plugin within a custom namespace like this:

import store from 'store';
import expirePlugin from 'store/plugins/expire';

store.addPlugin(expirePlugin);

const ns = store.namespace('foo');

ns.set('bar', 'test', new Date().getTime() + 60000);

What I get in localstorage is:

"__storejs_foo_bar": "test"
"__storejs_expire_mixin_bar": 1488974185349

So for what I understand if I save data in another namespace with the same key:

const ns2 = store.namespace('xyz');

ns2.set('bar', 'test 2', new Date().getTime() + 60000);

the expire timeout for the key bar will be overwritten.

It is possible to factor custom namespaces when using the expire plugin? Thanks.