Skip to content

DataAdapter

Defined in: store/adapters/DataAdapter.ts:117

A class representing a storage adapter that uses the local storage.

D extends DataSchema = DataSchema

new DataAdapter<D>(id): DataAdapter<D>

Defined in: store/adapters/DataAdapter.ts:127

string = 'data'

DataAdapter<D>

StorageAdapter.constructor

__dill_pixel_method_binding_root: boolean

Defined in: plugins/Plugin.ts:39

StorageAdapter.__dill_pixel_method_binding_root


data: D

Defined in: store/adapters/DataAdapter.ts:118


readonly id: string = 'data'

Defined in: store/adapters/DataAdapter.ts:127

The ID of the adapter. Default is ‘StorageAdapter’.

StorageAdapter.id


onDataChange: Signal<(detail) => void>

Defined in: store/adapters/DataAdapter.ts:120

Emits a signal when data changes.

IDataAdapter.onDataChange

get app(): A

Defined in: plugins/Plugin.ts:53

A

StorageAdapter.app


get options(): O

Defined in: plugins/Plugin.ts:44

O

StorageAdapter.options

addSignalConnection(…args): void

Defined in: plugins/Plugin.ts:79

Add signal connections to the container.

SignalConnection[]

The signal connections to add.

void

StorageAdapter.addSignalConnection


append<K>(key, value, separator): D[K]

Defined in: store/adapters/DataAdapter.ts:257

Appends a string to a string property.

K extends string | number | symbol

The type of keys in D where the value is a string

K

The key of the string property

string

The string to append

string = ''

D[K]

The new string after concatenation

IDataAdapter.append


clear(): void

Defined in: store/adapters/DataAdapter.ts:275

Deletes data from a specified key in the local storage.

void

IDataAdapter.clear


clearSignalConnections(): void

Defined in: plugins/Plugin.ts:85

void

StorageAdapter.clearSignalConnections


concat<K>(key, value): D[K]

Defined in: store/adapters/DataAdapter.ts:240

Concatenates a value or array of values to an array property.

K extends string | number | symbol

The type of keys in D where the value is an array

K

The key of the array property

D[K] extends E[] ? E | E[] : never

The value(s) to concatenate

D[K]

The new array after concatenation

IDataAdapter.concat


destroy(): void

Defined in: store/adapters/DataAdapter.ts:138

Destroys the adapter.

void

StorageAdapter.destroy


get(): D

Defined in: store/adapters/DataAdapter.ts:207

Loads data from storage. If a key is provided, returns the value for that key. If no key is provided, returns all data.

D

The loaded data

IDataAdapter.get

get<K>(key?): undefined | D[K]

Defined in: store/adapters/DataAdapter.ts:208

Loads data from storage. If a key is provided, returns the value for that key. If no key is provided, returns all data.

K extends string | number | symbol

The type of the key to load

K

Optional key to load specific data

undefined | D[K]

The loaded data

IDataAdapter.get


getCoreSignals(): string[]

Defined in: store/adapters/DataAdapter.ts:131

string[]

StorageAdapter.getCoreSignals


increment<K>(key, amount): D[K]

Defined in: store/adapters/DataAdapter.ts:223

Increments a numeric property by a specified amount.

K extends string | number | symbol

The type of keys in D where the value is a number

K

The key of the property to increment

number = 1

The amount to increment by (default: 1)

D[K]

The new value after incrementing

IDataAdapter.increment


initialize(options?): void

Defined in: store/adapters/DataAdapter.ts:147

Initializes the adapter.

Partial<IDataAdapterOptions<D>>

The options to initialize the adapter with.

void

StorageAdapter.initialize


load<TExpectedLoadResult>(_key): undefined | TExpectedLoadResult | Promise<TExpectedLoadResult>

Defined in: store/adapters/StorageAdapter.ts:59

Loads data from a specified key.

TExpectedLoadResult = any

string

The key from which to load the data.

undefined | TExpectedLoadResult | Promise<TExpectedLoadResult>

A promise that resolves with the loaded data, or the loaded data if the load operation is synchronous, or null if no data was found.

StorageAdapter.load


postInitialize(_app): void | Promise<void>

Defined in: plugins/Plugin.ts:68

IApplication

void | Promise<void>

StorageAdapter.postInitialize


save<TExpectedSaveResult>(_key, _data, …_rest): any

Defined in: store/adapters/StorageAdapter.ts:73

Saves data under a specified key.

TExpectedSaveResult = any

string

any

any[]

any

A promise that resolves when the data has been saved, or void if the save operation is synchronous.

StorageAdapter.save


set<K>(key, data): D

Defined in: store/adapters/DataAdapter.ts:162

Sets data for a specific key in storage.

K extends string | number | symbol

K

The key under which to save the data

D[K]

The data to save

D

The updated data object

IDataAdapter.set

set(data, merge?): D

Defined in: store/adapters/DataAdapter.ts:163

Merges data into storage.

DeepPartial<D>

The data object to set

boolean

Whether to merge with existing data

D

The updated data object

IDataAdapter.set


snapshot(): D

Defined in: store/adapters/DataAdapter.ts:292

Returns a snapshot of the current data.

D

A snapshot of the current data

IDataAdapter.snapshot

snapshot<K>(key?): D[K]

Defined in: store/adapters/DataAdapter.ts:293

Returns a snapshot of the current data for a specific key.

K extends string | number | symbol

K

The key of the data to snapshot

D[K]

A snapshot of the current data for the specified key

IDataAdapter.snapshot