import { MorphComponent } from 'morphux'; import { Main } from './main'; export class OutOfServiceMode { private _Main: Main; state: boolean = false; input: HTMLInputElement = document.querySelector( '.ntsh-outofservicemode-input', ); constructor(Main: Main) { this._Main = Main; this.registerListeners(); } private registerListeners() { this.input.addEventListener('change', async () => { const valid = await this._Main.executeCommand( this.state ? 'disableOutOfService' : 'enableOutOfService', `Are you sure you want to set the installation to "${this.state ? 'Out of Service' : 'Operational'}"?`, 'unityWebSocket', ); if (!valid) this.input.checked = this.state; this.state = this.input.checked; }); } }