@rpldy/safe-storage
    TypeScript icon, indicating that this package has built-in type declarations

    0.17.1 • Public • Published
    npm version circleci status codecov status bundlephobia badge rpldy storybook

    Safe Storage

    Internal package

    provides safe versions of localStorage and sessionStorage that don't throw because of browser issues like safari in private mode.

    exposes the same storage API as the browser's API -

    In case storage isn't supported, the same API is available but will be replaced with no-op versions.

    Installation

    #Yarn: 
       $ yarn add @rpldy/safe-storage
    
    #NPM:
       $ npm i @rpldy/safe-storage

    Important!

    All exports of this package are considered internal API and may change/disappear in any version: patch/minor/major

    Example

    import { safeLocalStorage } from "@rpldy/safe-storage";
    
    safeLocalStorage.setItem("test", "value");
    
    const stored = safeLocalStorage.getItem("test");
    
    safeLocalStorage.removeItem("test");

    Keywords

    none

    Install

    npm i @rpldy/safe-storage

    DownloadsWeekly Downloads

    111

    Version

    0.17.1

    License

    MIT

    Unpacked Size

    8.18 kB

    Total Files

    13

    Last publish

    Collaborators

    • yoavniran