@k8slens/extensions / Exports / Common / Store / PersistentStorageParams
Interface: PersistentStorageParams<T>#
Common.Store.PersistentStorageParams
Type parameters#
| Name | Type |
|---|---|
T |
extends object |
Hierarchy#
Omit<Options<T>,"migrations">
↳ PersistentStorageParams
Table of contents#
Properties#
Methods#
Properties#
configName#
• Readonly configName: string
Overrides#
Omit.configName
migrations#
• Optional Readonly migrations: Partial<Record<string, (store: MigrationStore) => void>>
syncOptions#
• Optional Readonly syncOptions: Object
Type declaration#
| Name | Type |
|---|---|
equals? |
IEqualsComparer<T> |
fireImmediately? |
boolean |
Methods#
fromStore#
▸ fromStore(data): void
fromStore is called internally when a child class syncs with the file system.
Note: This function must be synchronous.
Parameters#
| Name | Type | Description |
|---|---|---|
data |
Partial<T> |
the parsed information read from the stored JSON file |
Returns#
void
toJSON#
▸ toJSON(): T
toJSON is called when syncing the store to the filesystem. It should produce a JSON serializable object representation of the current state.
It is recommended that a round trip is valid. Namely, calling
this.fromStore(this.toJSON()) shouldn't change the state.
Returns#
T