new Calculate()
Manages one or more concurrent calculations within the model.
Members
-
:Array
calculationsActive <static>
-
A list of active calculation metadata.
Type
- Array
-
:Array
calculationsComplete <static>
-
A list of completed calculations that will soon be removed.
Type
- Array
-
:boolean
isCalculating <static>
-
Whether or not one or more calculations are currently in progress.
Type
- boolean
Methods
-
calculate() <static>
-
The callback method that handles active executing calculations.
-
cancel() <static>
-
Call this method to cancel all calculations that are currently in progress.
After this method has been called, all currently active calculations will prematurely terminate and be considered completed.
-
startCalculation(callback, payload [, options]) <static>
-
Add a calculation to the active calculations list.
Parameters:
Name Type Argument Description callbackfunction A function to invoke in the form
callback(payload, fraction).payloadobject An object to use as the first argument to the callback function.
optionsobject <optional>
An optional configuration object.
Properties of
options:Name Type Argument Description cancelledfunction <optional>
An optional callback function when cancelled, defaults to null.
completefunction <optional>
An optional callback function when complete, defaults to null.