t×tecexpressby TeKOcloud
DEv0.7.1
API & types / VUE

TxArrayStore.

Copied in-memory collection with local queries and key-based CRUD operations.

Vue: data = [], key = "id". Dart: data is required; without keyOf only queries are supported. Construction copies the list. Duplicate keys, insertion of existing keys and key changes are rejected. update/remove with an unknown key fail; byKey returns undefined/null.

ts
new TxArrayStore<T>(data?: readonly T[], key?: TxSelector<T>): TxArrayStore<T>
MemberType / returnBehavior
dataT[]Records or event payload.
keyTxSelector<T>Stable key or selector; distinct from a widget key.
load(o: TxLoadOptions<T>) => TxLoadResult<T>Loads using the supplied options; DataSource uses current query state without arguments. Errors propagate.
byKey(key: TxKey) => T | undefinedReads a record by key; missing keys return undefined (Vue) or null (Dart).
insert(item: T) => TInserts a record with a unique key and returns it.
update(key: TxKey, changes: Partial<T>) => T & Partial<T>Updates a notification or record.
remove(key: TxKey) => voidRemoves the record or recursively removes a file/directory tree.
ts
import { TxArrayStore } from '@tekocloud.de/tecexpress'
const store = new TxArrayStore([{ id: 1, text: 'One' }], 'id')
console.log(store.load({ take: 10 }), store.byKey(1))
store.insert({ id: 2, text: 'Two' })
store.update(2, { text: 'Updated' })
store.remove(2)