(event: string, handler: EventHandler)
| 147 | } |
| 148 | |
| 149 | off(event: string, handler: EventHandler): void { |
| 150 | const handlers = this.listeners.get(event) |
| 151 | if (handlers) { |
| 152 | const idx = handlers.indexOf(handler) |
| 153 | if (idx >= 0) handlers.splice(idx, 1) |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | async write(data: string): Promise<void> { |
| 158 | if (!window.openadeAPI || this._exited) return |