ResourceStoreMixin
Properties
3
Properties
3Class hierarchy
Records
Applies a new dataset to the ResourceStore. Use it to plug externally fetched data into the store.
NOTE: References (events, assignments) on the resources are determined async by a calculation engine. Thus they cannot be directly accessed after assigning the new dataset.
For example:
resourceStore.data = [{ id }];
// resourceStore.first.events is not yet available
To guarantee references are available, wait for calculations for finish:
resourceStore.data = [{ id }];
await resourceStore.project.commitAsync();
// resourceStore.first.events is available
Alternatively use loadDataAsync() instead:
await resourceStore.loadDataAsync([{ id }]);
// resourceStore.first.events is available
Functions
4
Functions
4CRUD
Add resources to the store.
NOTE: References (events, assignments) on the resources are determined async by a calculation engine. Thus they cannot be directly accessed after using this function.
For example:
const [resource] = resourceStore.add({ id });
// resource.events is not yet available
To guarantee references are set up, wait for calculations for finish:
const [resource] = resourceStore.add({ id });
await resourceStore.project.commitAsync();
// resource.events is available (assuming EventStore is loaded and so on)
Alternatively use addAsync() instead:
const [resource] = await resourceStore.addAsync({ id });
// resource.events is available (assuming EventStore is loaded and so on)
| Parameter | Type | Description |
|---|---|---|
records | ResourceModel | ResourceModel[] | ResourceModelConfig | ResourceModelConfig[] | Array of records/data or a single record/data to add to store |
silent | Boolean | Specify |
Added records
Add resources to the store and triggers calculations directly after. Await this function to have up to date references on the added resources.
const [resource] = await resourceStore.addAsync({ id });
// resource.events is available (assuming EventStore is loaded and so on)
| Parameter | Type | Description |
|---|---|---|
records | ResourceModel | ResourceModel[] | ResourceModelConfig | ResourceModelConfig[] | Array of records/data or a single record/data to add to store |
silent | Boolean | Specify |
Added records
Applies a new dataset to the ResourceStore and triggers calculations directly after. Use it to plug externally fetched data into the store.
await resourceStore.loadDataAsync([{ id }]);
// resourceStore.first.events is available
| Parameter | Type | Description |
|---|---|---|
data | ResourceModelConfig[] | Array of ResourceModel data objects |
Other
Returns all resources that have no events assigned during the specified time range.
| Parameter | Type | Description |
|---|---|---|
startDate | Date | Time range start date |
endDate | Date | Time range end date |
Resources without events