DependencyModel
This model represents a dependency between two events, usually added to a DependencyStore.
It is a subclass of the DependencyBaseModel class, which in its turn subclasses Model. Please refer to documentation of those classes to become familiar with the base interface of this class.
Fields and references
A Dependency has a few predefined fields, see Fields below. The name of any fields data source can be customized in the subclass, see the example below. Please also refer to Model for details.
class MyDependency extends DependencyModel {
static get fields() {
return [
{ name: 'to', dataSource: 'targetId' },
{ name: 'from', dataSource: 'sourceId' }
]);
}
}
After load and project normalization, these references are accessible (assuming their respective stores are loaded):
fromEvent- The event on the start side of the dependencytoEvent- The event on the end side of the dependency
Async resolving of references
As described above, a dependency has links to events. These references are populated async, using the calculation engine of the project that the resource via its store is a part of. Because of this asyncness, references cannot be used immediately after modifications:
dependency.from = 2;
// dependency.fromEvent is not yet up to date
To make sure references are updated, wait for calculations to finish:
dependency.from = 2;
await dependency.project.commitAsync();
// dependency.fromEvent is up to date
As an alternative, you can also use setAsync() to trigger calculations directly after the change:
await dependency.setAsync({ from : 2});
// dependency.fromEvent is up to date
Configs
1
Configs
1Properties
74
Properties
74Class hierarchy
Editing
JSON
Models & Stores
Parent & children
Functions
63
Functions
63Other
Converts lag value from one time unit to another. The method is a generator since it embeds into the Engine scheduling mechanics.
| Parameter | Type | Description |
|---|---|---|
lag | Number | Lag value |
fromUnit | DurationUnit | Lag value time unit |
toUnit | DurationUnit | Target time unit to convert the value to |
The converted lag value.
Configuration
Dependency
Editing
Events
Parent & children
Typedefs
2
Typedefs
2Fields
2
Fields
2Dependency
Set to false to ignore this dependency in scheduling
Other
The calendar of the dependency used to take lag duration into account.