Class: Calculate

PD. Calculate


new Calculate()

Manages one or more concurrent calculations within the model.

Author:
  • drajmarsh

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
callback function

A function to invoke in the form callback(payload, fraction).

payload object

An object to use as the first argument to the callback function.

options object <optional>

An optional configuration object.

Properties of options:
Name Type Argument Description
cancelled function <optional>

An optional callback function when cancelled, defaults to null.

complete function <optional>

An optional callback function when complete, defaults to null.