Monitors a boolean value and exposes functionality for performing logical operations with a given signal.
This module exposes no properties.
Method | Description |
---|---|
| and(other: BoolSignal): BoolSignal Performs a logical AND operation with the signal and the BoolSignal passed to the method and returns the result as a BoolSignal .If both signals are true then true is returned, otherwise false is returned.To perform an AND operation with more than two operands, use the Reactive.andList() method.
|
| delayBy(timeSpan: {milliseconds: number}): BoolSignal Delays a signal. The argument is an object with a "milliseconds" property specifying the delay duration in milliseconds. |
| eq(other: BoolSignal | boolean): BoolSignal Compares whether the signal's value is equal to the BoolSignal passed in the argument and returns the result as a BoolSignal .If the values are equal true is returned, otherwise false is returned.The Reactive.eq() method also allows two BoolSignal s to be compared.
|
| history(framesCount: number, initialValues?: Array<boolean>): SignalHistory<boolean> Returns a SignalHistory object containing the values of the signal from past frames.Historical signal values are initialized with the signal's value at the time the method was called, or with initialValues if provided.
|
| ifThenElse<T, U>(thenValue: EventSource<T>, elseValue: EventSource<U>): EventSource<T | U> Constructs a conditional if-then-else expression with the signal as the boolean condition. If the signal is true the returned signal will take the value of thenValue . Otherwise, it will take the value of elseValue . In the case of EventSource objects being passed to the method, the corresponding event will be returned.The type of signal returned ( ScalarSignal , StringSignal or BoolSignal ) depends on the values passed.
|
| monitor(config?: {fireOnInitialValue?: false | true}): EventSource<{newValue: boolean, oldValue: boolean}> Returns an EventSource that emits an event whenever the value of the BoolSignal changes.The event contains a JSON object which provides the old and new values of the signal in the format { "oldValue": boolean, "newValue": boolean } .// Load in the required modules
The config JSON object can have the following field:
|
| ne(other: BoolSignal | boolean): BoolSignal Compares whether the signal's value is not equal to the BoolSignal passed in the argument and returns the result as a BoolSignal .If the values are not equal true is returned, otherwise false is returned.The Reactive.ne() method provides equivalent functionality.
|
| not(): BoolSignal Performs a logical NOT operation with the signal and returns the result as a BoolSignal .If the signal is true , false will be returned and vice versa.The Reactive.not() method provides equivalent functionality. |
| onOff(config?: {fireOnInitialValue?: false | true}): EventSource<{newValue: boolean, oldValue: boolean}> Returns an EventSource that emits an event whenever the value of the signal changes to false .The event contains a JSON object which provides the old and new values of the signal in the format { "oldValue": boolean, "newValue": boolean } .
The config JSON object can have the following field:
|
| onOn(config?: {fireOnInitialValue?: false | true}): EventSource<{newValue: boolean, oldValue: boolean}> Returns an EventSource that emits an event whenever the value of the signal changes to true .The event contains a JSON object which provides the old and new values of the signal in the format { "oldValue": boolean, "newValue": boolean } .
The config JSON object can have the following field:
|
| or(other: BoolSignal): BoolSignal Performs a logical OR operation with the signal and the BoolSignal passed to the method and returns the result as a BoolSignal .If either one, or both, of the signals are true then true is returned. If neither signal is true then false is returned.To perform an OR operation with more than two operands, use the Reactive.orList() method.
|
| pin(): BoolSignal Returns a new BoolSignal with a constant value, which is equal to the value that the original signal contained immediately after the method was called. |
| pinLastValue(): ConstBoolSignal Returns a ConstBoolSignal with a constant value, which is equal to the value that the original signal contained immediately before the method was called.Unlike BoolSignal objects, ConstBoolSignal objects can be passed as an argument to methods that expect a primitive bool type. |
| xor(other: BoolSignal | boolean): BoolSignal Performs a logical XOR operation with the signal and the BoolSignal passed to the method and returns the result as a BoolSignal .If only one of the signals is true then true is returned. If both, or neither, of the signals are true then false is returned.To perform an XOR operation with more than two operands, use the Reactive.xorList() method.
|