Options
All
  • Public
  • Public/Protected
  • All
Menu

Class BaseComputationNode<T, K>

Type parameters

Hierarchy

Implements

Constructors

constructor

  • Base class for any non-input nodes with a "dispose" method.

    Parameters

    • inputs: K

      Input nodes to react on.

    • calculate: ProcessingFunction<K, T>

      Function to calculate input from output.

    • Default value changeHandler: function = () => {}
        • (): void
        • Returns void

    Returns BaseComputationNode

Properties

Protected calculate

calculate: ProcessingFunction<K, T>

Function to calculate input from output.

emitter

emitter: BitFieldEmitter<void> = new BitFieldEmitter<void>()

Emitter emiting events from the computationEvents enum.

Protected inputEmitters

inputEmitters: BitFieldEmitter<void>[]

Array of all inputEmitters the node has.

Protected inputs

inputs: K

Input nodes to react on.

state

state: computationFlags = computationFlags.active

inner property keeping track of the state

Protected Optional value

value: T

Inner property containing the current value of the node.

Protected volatileHandlers

volatileHandlers: Set<function> = new Set<BitFieldEventHandler<void>>()

Handlers to remove on dispose.

Methods

dispose

  • dispose(): this
  • Dispose the current node. Each node which extends this class is free to use the active state however it wants.

    Returns this

    The BaseComputationNode instance.

Private getProcessingInputs

  • getProcessingInputs(): object
  • Gets the values of all inputs

    Returns object

isActive

  • isActive(): number

Protected postUpdate

  • postUpdate(): void
  • Runs after an update is triggered.

    Returns void

triggerUpdate

  • triggerUpdate(): this
  • Trigger an update of the entire node.

    Note: the "changed" event won't be emited if the new value is the same as the old one.

    Note: the "updated" event will be emited even if the value is the same as the old one.

    Note: both the "updated" and "changed" events will be emitted at the same time.

    emits

    computationEvents.updated

    emits

    computationEvents.changed

    emits

    computationEvents.updated

    emits

    computationEvents.changed

    emits

    computationEvents.updated

    emits

    computationEvents.changed

    Returns this

    The LazyComputationNode instance.

Generated using TypeDoc