Skip to content

DataAdapter

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

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

new DataAdapter(id): DataAdapter

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

string = 'data'

DataAdapter

StorageAdapter.constructor

data: DataSchema

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


readonly id: string = 'data'

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

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

StorageAdapter.id


onDataChange: Signal<(detail) => void>

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

Emits a signal when data changes.

IDataAdapter.onDataChange

get app(): Application

Defined in: plugins/Plugin.ts:52

Application

StorageAdapter.app


get options(): O

Defined in: plugins/Plugin.ts:44

O

StorageAdapter.options

addSignalConnection(…args): void

Defined in: plugins/Plugin.ts:78

Add signal connections to the container.

SignalConnection[]

The signal connections to add.

void

StorageAdapter.addSignalConnection


append<K>(key, value, separator): any

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

Appends a string to a string property.

K extends string

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 = ''

any

The new string after concatenation

IDataAdapter.append


clear(): void

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

Deletes data from a specified key in the local storage.

void

IDataAdapter.clear


clearSignalConnections(): void

Defined in: plugins/Plugin.ts:84

void

StorageAdapter.clearSignalConnections


concat<K>(key, value): any

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

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

K extends string

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

K

The key of the array property

unknown

The value(s) to concatenate

any

The new array after concatenation

IDataAdapter.concat


destroy(): void

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

Destroys the adapter.

void

StorageAdapter.destroy


get(): DataSchema

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

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

DataSchema

The loaded data

IDataAdapter.get

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

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

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

The type of the key to load

K

Optional key to load specific data

undefined | DataSchema[K]

The loaded data

IDataAdapter.get


getCoreSignals(): string[]

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

string[]

StorageAdapter.getCoreSignals


increment<K>(key, amount): any

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

Increments a numeric property by a specified amount.

K extends string

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)

any

The new value after incrementing

IDataAdapter.increment


initialize(options?): void

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

Initializes the adapter.

Partial<DataSchema>

The options to initialize the adapter with.

void

StorageAdapter.initialize


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

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

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:67

IApplication

void | Promise<void>

StorageAdapter.postInitialize


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

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

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): DataSchema

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

Sets data for a specific key in storage.

K extends string | number

K

The key under which to save the data

DataSchema[K]

The data to save

DataSchema

The updated data object

IDataAdapter.set

set(data, merge?): DataSchema

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

Merges data into storage.

DeepPartial<DataAdapterType>

The data object to set

boolean

Whether to merge with existing data

DataSchema

The updated data object

IDataAdapter.set


snapshot(): DataSchema

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

Returns a snapshot of the current data.

DataSchema

A snapshot of the current data

IDataAdapter.snapshot

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

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

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

K extends string | number

K

The key of the data to snapshot

DataSchema[K]

A snapshot of the current data for the specified key

IDataAdapter.snapshot