RNAsyncStorageManager<T>
Defined in: atomiq-storage-rn-async/src/RNAsyncStorageManager.ts:10
React Native AsyncStorage implementation of IStorageManager. Persists StorageObject instances using React Native's AsyncStorage.
Type Parameters
| Type Parameter | Default type | Description |
|---|---|---|
T extends StorageObject | StorageObject | Type of StorageObject to manage |
Implements
Constructors
Constructor
new RNAsyncStorageManager<T>(asyncStoragePrefix): RNAsyncStorageManager<T>;
Defined in: atomiq-storage-rn-async/src/RNAsyncStorageManager.ts:19
Creates a new RNAsyncStorageManager instance
Parameters
| Parameter | Type | Description |
|---|---|---|
asyncStoragePrefix | string | Prefix added to all keys to avoid collisions with other data |
Returns
RNAsyncStorageManager<T>
Properties
data
data: object = {};
Defined in: atomiq-storage-rn-async/src/RNAsyncStorageManager.ts:29
In-memory cache of stored objects, keyed by hash
Index Signature
[p: string]: T
Implementation of
prefix
readonly prefix: string;
Defined in: atomiq-storage-rn-async/src/RNAsyncStorageManager.ts:13
Key prefix used to namespace storage entries
Methods
init()
init(): Promise<void>;
Defined in: atomiq-storage-rn-async/src/RNAsyncStorageManager.ts:24
Initializes the storage backend
Returns
Promise<void>
Implementation of
loadData()
loadData(type): Promise<T[]>;
Defined in: atomiq-storage-rn-async/src/RNAsyncStorageManager.ts:32
Loads all stored objects and deserializes them using the provided constructor
Parameters
| Parameter | Type | Description |
|---|---|---|
type | (data) => T | Constructor function to instantiate each object |
Returns
Promise<T[]>
Array of deserialized objects
Implementation of
removeData()
removeData(hash): Promise<void>;
Defined in: atomiq-storage-rn-async/src/RNAsyncStorageManager.ts:53
Removes an object from storage
Parameters
| Parameter | Type | Description |
|---|---|---|
hash | string | Identifier of the object to remove |
Returns
Promise<void>
Implementation of
removeDataArr()
removeDataArr(keys): Promise<void>;
Defined in: atomiq-storage-rn-async/src/RNAsyncStorageManager.ts:59
Removes multiple objects from storage (optional batch operation)
Parameters
| Parameter | Type | Description |
|---|---|---|
keys | string[] | Array of identifiers to remove |
Returns
Promise<void>
Implementation of
saveData()
saveData(hash, object): Promise<void>;
Defined in: atomiq-storage-rn-async/src/RNAsyncStorageManager.ts:65
Saves an object to storage
Parameters
| Parameter | Type | Description |
|---|---|---|
hash | string | Unique identifier for the object |
object | T | Object to save |
Returns
Promise<void>
Implementation of
saveDataArr()
saveDataArr(values): Promise<void>;
Defined in: atomiq-storage-rn-async/src/RNAsyncStorageManager.ts:71
Saves multiple objects to storage (optional batch operation)
Parameters
| Parameter | Type | Description |
|---|---|---|
values | object[] | Array of id-object pairs to save |
Returns
Promise<void>