JSPM

histore

1.0.0
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 49
    • Score
      100M100P100Q69901F
    • License apache-2.0

    200b key-value store backed by navigation state.

    Package Exports

    • histore

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (histore) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    Histore

    Histore [his·to·ry]: a 200b key-value store backed by navigation state.

    Does the fact that sessionStorage/localStorage is shared across tabs have you down?

    Don't worry, here's a strange but widely supported way to store 640kb of object data in a page's navigation state.

    Usage

    import histore from 'histore'
    
    let storage = histore()
    
    storage.set('foo', 'bar')
    storage.get('foo')  // 'bar'
    
    storage.set('obj', { any: 'object' })
    storage.get('obj').any  // 'object'

    Interestingly, due to the way history.replaceState works, storing objects will implicitly clone them using the Structured Clone algorithm.

    License

    Apache 2.0.