Represents a source used to get and set the value of a ScalarSignal
.
Typically, changing the value that a signal contains requires a total reassignment:
TouchGestures.onTap().subscribe((gesture) => {
someSignal = Reactive.val(1);
});
someSignal
is bound to a completely new signal which itself contains the desired value.ScalarSignalSource
API provides the ability to change the value of the original signal without reassignment, with behavior similar to that of non-reactive programming models.Property | Description |
---|---|
| (get) signal: ScalarSignal The signal being monitored by the ScalarSignalSource object.Accessing the signal's value before one has been assigned via set() will return 0 . |
Method | Description |
---|---|
| dispose(): void Disposes of the native resources associated with the ScalarSignalSource object.The ScalarSignalSource object will still exist as a JavaScript object but will not receive updates through future calls to set() . Do not call dispose() until you're certain that the signal is no longer required.When calling ReactiveModule.scalarSignalSource , avoid reusing the sourceId of an object that you've called dispose() on. |
| set(value: ScalarSignal | number): void Sets the value of the signal monitored by the ScalarSignalSource object to value .The updated signal value will be propagated throughout all signals related to the ScalarSignalSource .If set() is called before signal , signal will return the value assigned by set() when called, rather than the default value of 0 .
|