browserstorage-ttl

    1.0.4 • Public • Published

    browserstorage-ttl

    Localstorage with time to live / expiry, if expiry is zero uses SessionStorage

    Usage

    npm install browserstorage-ttl

    In your file

    import Storage from 'browserstorage-ttl';
     
     
    Storage.set('key', 'value', 30);  // 30 minutes as ttl
    const k = Storage.get('key');
    console.log(k); // value
     
    Storage.set('anotherkey', 'anothervalue', 0);  // 0 minutes as ttl, will use sessionStorage
    const t = Storage.get('anotherkey');
     
    console.log(t); // anothervalue
     

    Install

    npm i browserstorage-ttl

    DownloadsWeekly Downloads

    13

    Version

    1.0.4

    License

    GPL-3.0

    Unpacked Size

    5.34 kB

    Total Files

    6

    Last publish

    Collaborators

    • mohamedfasil