Adrià Vilanova MartÃnez | 12c84c3 | 2024-10-19 15:55:15 +0200 | [diff] [blame] | 1 | import Script from "../../../common/architecture/scripts/Script"; |
| 2 | import { NodeWatcherHandler } from "../../../presentation/nodeWatcher/NodeWatcherHandler"; |
| 3 | import { NodeWatcherPort } from "../../../presentation/nodeWatcher/NodeWatcher.port"; |
| 4 | |
| 5 | export 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 | } |