blob: 29dbd1f1ff70d3a7b65dd7c53b3abc6d8f02c148 [file] [log] [blame]
Adrià Vilanova Martínez12c84c32024-10-19 15:55:15 +02001import Script from "../../../common/architecture/scripts/Script";
2import { NodeWatcherHandler } from "../../../presentation/nodeWatcher/NodeWatcherHandler";
3import { NodeWatcherPort } from "../../../presentation/nodeWatcher/NodeWatcher.port";
4
5export default class NodeWatcherScriptAdapter extends Script {
6 // TODO: Delete this once these properties are removed from Script.
7 page: never;
8 environment: never;
9 runPhase: never;
10
11 constructor(
12 private nodeWatcher: NodeWatcherPort,
13 private handlers: Map<string, NodeWatcherHandler>,
14 ) {
15 super();
16 }
17
18 execute() {
19 this.nodeWatcher.start();
20 for (const [key, handler] of this.handlers) {
21 this.nodeWatcher.setHandler(key, handler);
22 }
23 }
24}