Class: Constraint

Constraint()

Class to manage constrained variables

Constructor

new Constraint()

Creates a new constrained object
Source:

Members

deps

List of variables which depend on this variable
Properties:
Type Description
Array
Source:

stack

Stack which keeps track of dependencies which must be reevaluated
Properties:
Type Description
Array
Source:

type

States whether the function is a primitive or variable
Properties:
Type Description
String
Source:

valid

Whether or not the variable must be reevaluated
Properties:
Type Description
Boolean
Source:

value

Last calculated value of the variable
Properties:
Type Description
Number
Source:

Methods

eval()

Function which evaluates the new value of the variable
Properties:
Type Description
function
Source:

get() → {Number}

Updates the values of invalid constrained variables
Source:
Returns:
The value of the recalculated variable
Type
Number

invalidate()

Function which invalidates the current variable and its dependents. Also resets the dependencies of the variable
Source:

set(fn)

Set's the evaluation function for the provided variable and invalidates dependents
Parameters:
Name Type Description
fn function The function to evaluate the variable value
Source: