ResourceStoreMixin

Properties

3

Class hierarchy

isResourceStoreMixin: Boolean= truereadonly
Identifies an object as an instance of ResourceStoreMixin class, or subclass thereof.
isResourceStoreMixin: Boolean= truereadonlystatic
Identifies an object as an instance of ResourceStoreMixin class, or subclass thereof.

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

CRUD

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)
ParameterTypeDescription
recordsResourceModel | ResourceModel[] | ResourceModelConfig | ResourceModelConfig[]

Array of records/data or a single record/data to add to store

silentBoolean

Specify true to suppress events

Returns: ResourceModel[] -

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)
ParameterTypeDescription
recordsResourceModel | ResourceModel[] | ResourceModelConfig | ResourceModelConfig[]

Array of records/data or a single record/data to add to store

silentBoolean

Specify true to suppress events

Returns: ResourceModel[] -

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
ParameterTypeDescription
dataResourceModelConfig[]

Array of ResourceModel data objects

Other

Returns all resources that have no events assigned during the specified time range.

ParameterTypeDescription
startDateDate

Time range start date

endDateDate

Time range end date

Returns: ResourceModel[] -

Resources without events