IndexedDBUnifiedStorage
Defined in: atomiq-sdk/src/storage-browser/IndexedDBUnifiedStorage.ts:66
Browser IndexedDB storage implementation
Implements
Constructors
Constructor
new IndexedDBUnifiedStorage(storageKey): IndexedDBUnifiedStorage;
Defined in: atomiq-sdk/src/storage-browser/IndexedDBUnifiedStorage.ts:73
Parameters
| Parameter | Type |
|---|---|
storageKey | string |
Returns
IndexedDBUnifiedStorage
Properties
db?
optional db: IDBDatabase;
Defined in: atomiq-sdk/src/storage-browser/IndexedDBUnifiedStorage.ts:71
storageKey
readonly storageKey: string;
Defined in: atomiq-sdk/src/storage-browser/IndexedDBUnifiedStorage.ts:70
logger
protected readonly logger: LoggerType;
Defined in: atomiq-sdk/src/storage-browser/IndexedDBUnifiedStorage.ts:68
Methods
init()
init(): Promise<void>;
Defined in: atomiq-sdk/src/storage-browser/IndexedDBUnifiedStorage.ts:246
Initializes the storage with given indexes and composite indexes
Returns
Promise<void>
Implementation of
query()
query(params): Promise<any[]>;
Defined in: atomiq-sdk/src/storage-browser/IndexedDBUnifiedStorage.ts:268
Params are specified in the following way:
- [[condition1, condition2]] - returns all rows where condition1 AND condition2 is met
- [[condition1], [condition2]] - returns all rows where condition1 OR condition2 is met
- [[condition1, condition2], [condition3]] - returns all rows where (condition1 AND condition2) OR condition3 is met
Parameters
| Parameter | Type | Description |
|---|---|---|
params | QueryParams[][] |
Returns
Promise<any[]>
Implementation of
remove()
remove(object): Promise<void>;
Defined in: atomiq-sdk/src/storage-browser/IndexedDBUnifiedStorage.ts:319
Removes an object from storage
Parameters
| Parameter | Type | Description |
|---|---|---|
object | any | Object to remove (must have an id property) |
Returns
Promise<void>
Implementation of
removeAll()
removeAll(arr): Promise<void>;
Defined in: atomiq-sdk/src/storage-browser/IndexedDBUnifiedStorage.ts:327
Removes multiple objects from storage in a batch operation
Parameters
| Parameter | Type | Description |
|---|---|---|
arr | any[] | Array of objects to remove |
Returns
Promise<void>
Implementation of
save()
save(object): Promise<void>;
Defined in: atomiq-sdk/src/storage-browser/IndexedDBUnifiedStorage.ts:337
Saves an object to storage, updating indexes as needed
Parameters
| Parameter | Type | Description |
|---|---|---|
object | any | Object to save (must have an id property) |
Returns
Promise<void>
Implementation of
saveAll()
saveAll(arr): Promise<void>;
Defined in: atomiq-sdk/src/storage-browser/IndexedDBUnifiedStorage.ts:344
Saves multiple objects to storage in a batch operation
Parameters
| Parameter | Type | Description |
|---|---|---|
arr | any[] | Array of objects to save |
Returns
Promise<void>
Implementation of
tryMigrate()
tryMigrate(storageKeys, reviver): Promise<boolean>;
Defined in: atomiq-sdk/src/storage-browser/IndexedDBUnifiedStorage.ts:179
Attempts to migrate the swap database from old implementations (either using prior version of IndexedDB or Local Storage)
NOTE: Reviver also needs to update the swap to the latest version
Parameters
| Parameter | Type | Description |
|---|---|---|
storageKeys | [string, SwapType][] | An array of tuples of storage keys used for the corresponding swap types |
reviver | (obj) => ISwap | Swap data deserializer |
Returns
Promise<boolean>