LocalStorage which can be set expires.
npm install -S @jswork/next-local-expires
api | params | description |
---|---|---|
set | inKey, inValue, inExpires | set value with expires (ms) |
get | - | get the right value if is in time, or will get null |
import NxLocalExpires from '@jswork/next-local-expires';
// code goes here:
const store = new NxLocalExpires();
store.set('login',{ token: 'YWRmajEyMzMx' }, 5*24*60*60*1000)
store.get('login');
// { token: 'YWRmajEyMzMx' }
Code released under the MIT license.