1.17.0 • Published 6 months ago

@azot-dev/cortex-storage-react-native-adapter v1.17.0

Weekly downloads
-
License
-
Repository
-
Last release
6 months ago

React-native Storage Adapter

installation

npm i @azot-dev/cortex-storage-react-native-adapter

or

yarn add @azot-dev/cortex-storage-react-native-adapter

adapter

export * from '../storage.gateway';
import { StorageGateway } from '../storage.gateway';
import AsyncStorage from '@react-native-async-storage/async-storage';

export class ReactStorageAdapter implements StorageGateway {
  getItem = AsyncStorage.getItem;
  setItem = AsyncStorage.setItem;
  removeItem = AsyncStorage.removeItem;
  clear = AsyncStorage.clear;
  async getAllKeys() {
    const keys = await AsyncStorage.getAllKeys();
    return [...keys];
  }
}

gateway

export interface StorageGateway {
  getItem(key: string): Promise<any>;
  setItem(key: string, value: any): Promise<void>;
  removeItem(key: string): Promise<void>;
  clear(): Promise<void>;
  getAllKeys(): Promise<string[]>;
}
1.15.0

6 months ago

1.14.0

6 months ago

1.13.0

6 months ago

1.12.0

6 months ago

1.17.0

6 months ago

1.16.0

6 months ago

1.11.0

6 months ago

1.10.0

7 months ago

1.4.0

7 months ago

1.3.0

7 months ago

1.2.0

7 months ago

1.1.0

7 months ago

1.9.0

7 months ago

1.8.0

7 months ago

1.7.0

7 months ago

1.6.0

7 months ago

1.5.0

7 months ago