DataAdapter
Defined in: store/adapters/DataAdapter.ts:118
A class representing a storage adapter that uses the local storage.
Extends
Type Parameters
• D extends DataSchema
= DataSchema
Implements
IDataAdapter
<D
>
Constructors
new DataAdapter()
new DataAdapter<
D
>(id
):DataAdapter
<D
>
Defined in: store/adapters/DataAdapter.ts:128
Parameters
id
string
= 'data'
Returns
DataAdapter
<D
>
Overrides
Properties
__dill_pixel_method_binding_root
__dill_pixel_method_binding_root:
boolean
Defined in: plugins/Plugin.ts:37
Inherited from
StorageAdapter
.__dill_pixel_method_binding_root
data
data:
D
Defined in: store/adapters/DataAdapter.ts:119
id
readonly
id:string
='data'
Defined in: store/adapters/DataAdapter.ts:128
The ID of the adapter. Default is ‘StorageAdapter’.
Inherited from
onDataChange
onDataChange:
Signal
<(detail
) =>void
>
Defined in: store/adapters/DataAdapter.ts:121
Emits a signal when data changes.
Implementation of
Accessors
app
Get Signature
get app():
T
Defined in: plugins/Plugin.ts:45
Returns
T
Inherited from
Methods
addSignalConnection()
addSignalConnection(…
args
):void
Defined in: plugins/Plugin.ts:71
Add signal connections to the container.
Parameters
args
…SignalConnection
[]
The signal connections to add.
Returns
void
Inherited from
StorageAdapter
.addSignalConnection
append()
append<
K
>(key
,value
,separator
):D
[K
]
Defined in: store/adapters/DataAdapter.ts:258
Appends a string to a string property.
Type Parameters
• K extends string
| number
| symbol
The type of keys in D where the value is a string
Parameters
key
K
The key of the string property
value
string
The string to append
separator
string
= ''
Returns
D
[K
]
The new string after concatenation
Implementation of
clear()
clear():
void
Defined in: store/adapters/DataAdapter.ts:276
Deletes data from a specified key in the local storage.
Returns
void
Implementation of
clearSignalConnections()
clearSignalConnections():
void
Defined in: plugins/Plugin.ts:77
Returns
void
Inherited from
StorageAdapter
.clearSignalConnections
concat()
concat<
K
>(key
,value
):D
[K
]
Defined in: store/adapters/DataAdapter.ts:241
Concatenates a value or array of values to an array property.
Type Parameters
• K extends string
| number
| symbol
The type of keys in D where the value is an array
Parameters
key
K
The key of the array property
value
D
[K
] extends E
[] ? E
| E
[] : never
The value(s) to concatenate
Returns
D
[K
]
The new array after concatenation
Implementation of
destroy()
destroy():
void
Defined in: store/adapters/DataAdapter.ts:139
Destroys the adapter.
Returns
void
Overrides
get()
Call Signature
get():
D
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.
Returns
D
The loaded data
Implementation of
Call Signature
get<
K
>(key
?):undefined
|D
[K
]
Defined in: store/adapters/DataAdapter.ts:209
Loads data from storage. If a key is provided, returns the value for that key. If no key is provided, returns all data.
Type Parameters
• K extends string
| number
| symbol
The type of the key to load
Parameters
key?
K
Optional key to load specific data
Returns
undefined
| D
[K
]
The loaded data
Implementation of
getCoreSignals()
getCoreSignals():
string
[]
Defined in: store/adapters/DataAdapter.ts:132
Returns
string
[]
Overrides
StorageAdapter.getCoreSignals
increment()
increment<
K
>(key
,amount
):D
[K
]
Defined in: store/adapters/DataAdapter.ts:224
Increments a numeric property by a specified amount.
Type Parameters
• K extends string
| number
| symbol
The type of keys in D where the value is a number
Parameters
key
K
The key of the property to increment
amount
number
= 1
The amount to increment by (default: 1)
Returns
D
[K
]
The new value after incrementing
Implementation of
initialize()
initialize(
_app
,options
?):void
Defined in: store/adapters/DataAdapter.ts:148
Initializes the adapter.
Parameters
_app
The application that the adapter belongs to.
options?
Partial
<IDataAdapterOptions
<D
>>
The options to initialize the adapter with.
Returns
void
Overrides
load()
load<
TExpectedLoadResult
>(_key
):undefined
|TExpectedLoadResult
|Promise
<TExpectedLoadResult
>
Defined in: store/adapters/StorageAdapter.ts:59
Loads data from a specified key.
Type Parameters
• TExpectedLoadResult = any
Parameters
_key
string
The key from which to load the data.
Returns
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.
Inherited from
postInitialize()
postInitialize(
_app
):void
|Promise
<void
>
Defined in: plugins/Plugin.ts:60
Parameters
_app
Returns
void
| Promise
<void
>
Inherited from
save()
save<
TExpectedSaveResult
>(_key
,_data
, …_rest
):any
Defined in: store/adapters/StorageAdapter.ts:73
Saves data under a specified key.
Type Parameters
• TExpectedSaveResult = any
Parameters
_key
string
_data
any
_rest
…any
[]
Returns
any
A promise that resolves when the data has been saved, or void if the save operation is synchronous.
Inherited from
set()
Call Signature
set<
K
>(key
,data
):D
Defined in: store/adapters/DataAdapter.ts:163
Sets data for a specific key in storage.
Type Parameters
• K extends string
| number
| symbol
Parameters
key
K
The key under which to save the data
data
D
[K
]
The data to save
Returns
D
The updated data object
Implementation of
Call Signature
set(
data
,merge
?):D
Defined in: store/adapters/DataAdapter.ts:164
Merges data into storage.
Parameters
data
DeepPartial
<D
>
The data object to set
merge?
boolean
Whether to merge with existing data
Returns
D
The updated data object
Implementation of
snapshot()
Call Signature
snapshot():
D
Defined in: store/adapters/DataAdapter.ts:293
Returns a snapshot of the current data.
Returns
D
A snapshot of the current data
Implementation of
Call Signature
snapshot<
K
>(key
?):D
[K
]
Defined in: store/adapters/DataAdapter.ts:294
Returns a snapshot of the current data for a specific key.
Type Parameters
• K extends string
| number
| symbol
Parameters
key?
K
The key of the data to snapshot
Returns
D
[K
]
A snapshot of the current data for the specified key