2.0.1 • Published 3 months ago

@springtree/eva-sdk-core-storage v2.0.1

Weekly downloads
67
License
UNLICENSED
Repository
github
Last release
3 months ago

@springtree/eva-sdk-core-storage

Provides a wrapper around browser localStorage. If localStorage is unvailable (private mode browsing) it will fallback to memory storage solution. This will allow your app and other packages form the SDK to use a consistent API. It will also allow for normal storage functionality within a private browsing session.

Usage

import { EvaStorage } from '@springtree/eva-sdk-core-storage';

// Declare your own storage keys
//
export interface IMyAppStorage {
  'key1'?: string;
  'key2'?: string;
}

// Instatiate with out storage shape for type completion on get/set methods
//
const evaStorage = new EvaStorage<IMyAppStorage>();

// Provides methods as found on browser localStorage
//
evaStorage.getItem( 'key2' );

evaStorage.setItem( 'key1', 'my value' );

evaStorage.removeItem( 'key2' );

evaStorage.clear();
2.0.1

3 months ago

2.0.0

3 months ago

1.3.2

3 years ago

1.2.11

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.10

3 years ago

1.2.9

3 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

5 years ago

1.1.2

5 years ago