Class CrudArrayObjectStore<S>
Type Parameters
- S extends BaseObjectEntryStore<any>
Hierarchy
- ArrayObjectStore<S>
- CrudArrayObjectStore (View Summary)
Constructors
constructor
-
new CrudArrayObjectStore<S extends BaseObjectEntryStore<any>>(
options: CrudArrayObjectStore.Options.Config<S>,
): CrudArrayObjectStore<S>Type Parameters
- S extends BaseObjectEntryStore<any>
Store type.
Parameters
- options: CrudArrayObjectStore.Options.Config<S>
CrudArrayObjectStore options.
Returns CrudArrayObjectStore<S>
- S extends BaseObjectEntryStore<any>
Accessors
Protected_data
-
Returns S[]
The internal data array tracked allowing child classes direct access.
dataReducer
-
Returns DynArrayReducer<S>
The data reducer.
length
-
get length(): number
Returns number
The length of all data.
StaticEntryStore
-
Returns typeof ObjectEntryStore
The default object entry store constructor that can facilitate the creation of the required ArrayObjectStore.Options.Config.StoreClass and generic
Ttype parameter.
Methods
[iterator]
clearEntries
-
Removes all child store entries.
Returns void
createEntry
-
Creates a new store from given data.
Parameters
- entryData: ExtractDataType<S>
Returns S
Associated store with entry data.
deleteEntry
-
Deletes a given entry store by ID from this array object store instance.
Parameters
- id: string
ID of entry to delete.
Returns boolean
Delete operation successful.
- id: string
duplicateEntry
-
Duplicates an entry store by the given ID.
Parameters
- id: string
UUIDv4 string.
Returns S
Instance of StoreClass.
- id: string
findEntry
getEntry
-
Finds an entry store instance by 'id' / UUIDv4.
Parameters
- id: string
A UUIDv4 string.
Returns S
Entry store instance.
- id: string
set
-
Sets the children store data by 'id', adds new entry store instances, or removes entries that are no longer in the update list.
Parameters
- updateList: ExtractDataType<S>[]
Returns void
subscribe
-
Parameters
- handler: Subscriber<S[]>
Callback function that is invoked on update / changes.
Returns Unsubscriber
Unsubscribe function.
- handler: Subscriber<S[]>
toJSON
-
Returns S[]
updateSubscribers
-
Updates subscribers, but provides special handling when a
crudDispatchfunction is attached. Whenupdateis an object with a valid UUIDv4 string as the id property thecrudDispatchfunction is invoked along with the data payload.Parameters
Optionalupdate: boolean | ExtractDataType<S>A boolean indicating that subscribers should be notified otherwise
Returns void
Store type.