Build PLC-like applications with Deno.js. Write VHDL-like code with TypeScript.
Looking out for the simple API docs because one of your libraries uses TypedSignal?
using A = new SignalVariable<boolean>(true);
using B = new SignalVariable<number>(3);
using C /* : TypedSignal<boolean> */ = new SignalCast(B, (val) => val > 5);// number > boolean
using Result = new SignalAnd([A, C]);
console.log(Result.value); // false
B.value = 8;
console.log(Result.value); // true
Reads the current value.
Registers a listener for value changes.
Removes the listener again.
Registers a listener for object dispose. Read more about disposing below.
Removes the dispose listener again.
Returns true if the object has been disposed.
Returns true if the current value strict equals the given value.
// more docs coming soon
You can (and should) dispose TypedSignals if they are no longer needed by
calling TypedSignal<T>.dispose()
. [Signal.dispose]
is an alias. After the
object got disposed any attempt to do something with it (eg. reading its value,
registering listeners) will throw a DisposedError
.
Copyright (C) 2023 Hans Schallmoser
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.