(terminal: Terminal)
| 31 | } |
| 32 | |
| 33 | public activate(terminal: Terminal): void { |
| 34 | this._disposables.push( |
| 35 | addSocketListener(this._socket, 'message', (ev) => { |
| 36 | const data: ArrayBuffer | string = ev.data; |
| 37 | terminal.write(typeof data === 'string' ? data : new Uint8Array(data)); |
| 38 | }) |
| 39 | ); |
| 40 | |
| 41 | if (this._bidirectional) { |
| 42 | this._disposables.push(terminal.onData((data) => this._sendData(data))); |
| 43 | } |
| 44 | |
| 45 | this._disposables.push( |
| 46 | addSocketListener(this._socket, 'close', (e) => { |
| 47 | if (this._onError && e.code === 1011 && e.reason) { |
| 48 | this._onError(new Error(e.reason)); |
| 49 | } |
| 50 | |
| 51 | this.dispose(); |
| 52 | }) |
| 53 | ); |
| 54 | this._disposables.push(addSocketListener(this._socket, 'error', () => this.dispose())); |
| 55 | } |
| 56 | |
| 57 | public dispose() { |
| 58 | this._disposables.forEach((d) => d.dispose()); |
nothing calls this directly
no test coverage detected