MCPcopy Create free account
hub / github.com/devspace-sh/devspace / activate

Method activate

ui/src/lib/attach.ts:33–55  ·  view source on GitHub ↗
(terminal: Terminal)

Source from the content-addressed store, hash-verified

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());

Callers

nothing calls this directly

Calls 4

_sendDataMethod · 0.95
disposeMethod · 0.95
addSocketListenerFunction · 0.85
writeMethod · 0.80

Tested by

no test coverage detected