1 | import { optionsFromArguments } from "../core/util/Defaults.js";
|
2 | import { Subtract } from "./Subtract.js";
|
3 | import { Signal } from "./Signal.js";
|
4 | import { GreaterThanZero } from "./GreaterThanZero.js";
|
5 | import { readOnly } from "../core/util/Interface.js";
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | export class GreaterThan extends Signal {
|
18 | constructor() {
|
19 | const options = optionsFromArguments(GreaterThan.getDefaults(), arguments, ["value"]);
|
20 | super(options);
|
21 | this.name = "GreaterThan";
|
22 | this.override = false;
|
23 | this._subtract = this.input = new Subtract({
|
24 | context: this.context,
|
25 | value: options.value,
|
26 | });
|
27 | this._gtz = this.output = new GreaterThanZero({
|
28 | context: this.context,
|
29 | });
|
30 | this.comparator = this._param = this._subtract.subtrahend;
|
31 | readOnly(this, "comparator");
|
32 |
|
33 | this._subtract.connect(this._gtz);
|
34 | }
|
35 | static getDefaults() {
|
36 | return Object.assign(Signal.getDefaults(), {
|
37 | value: 0,
|
38 | });
|
39 | }
|
40 | dispose() {
|
41 | super.dispose();
|
42 | this._gtz.dispose();
|
43 | this._subtract.dispose();
|
44 | this.comparator.dispose();
|
45 | return this;
|
46 | }
|
47 | }
|
48 |
|
\ | No newline at end of file |