X-Git-Url: https://git.josue.xyz/?p=VSoRC%2F.git;a=blobdiff_plain;f=node_modules%2Fxterm-addon-attach%2Fout%2FAttachAddon.js;fp=node_modules%2Fxterm-addon-attach%2Fout%2FAttachAddon.js;h=2929602bf029d03b897cc57ec8916c330b258157;hp=0000000000000000000000000000000000000000;hb=2b1de44527123fab80901384e0f374367500ced8;hpb=e79e4a5a87f3e84f7c1777f10a954453a69bf540 diff --git a/node_modules/xterm-addon-attach/out/AttachAddon.js b/node_modules/xterm-addon-attach/out/AttachAddon.js new file mode 100644 index 0000000..2929602 --- /dev/null +++ b/node_modules/xterm-addon-attach/out/AttachAddon.js @@ -0,0 +1,43 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +class AttachAddon { + constructor(socket, options) { + this._disposables = []; + this._socket = socket; + this._socket.binaryType = 'arraybuffer'; + this._bidirectional = (options && options.bidirectional === false) ? false : true; + } + activate(terminal) { + this._disposables.push(addSocketListener(this._socket, 'message', ev => { + const data = ev.data; + terminal.write(typeof data === 'string' ? data : new Uint8Array(data)); + })); + if (this._bidirectional) { + this._disposables.push(terminal.onData(data => this._sendData(data))); + } + this._disposables.push(addSocketListener(this._socket, 'close', () => this.dispose())); + this._disposables.push(addSocketListener(this._socket, 'error', () => this.dispose())); + } + dispose() { + this._disposables.forEach(d => d.dispose()); + } + _sendData(data) { + if (this._socket.readyState !== 1) { + return; + } + this._socket.send(data); + } +} +exports.AttachAddon = AttachAddon; +function addSocketListener(socket, type, handler) { + socket.addEventListener(type, handler); + return { + dispose: () => { + if (!handler) { + return; + } + socket.removeEventListener(type, handler); + } + }; +} +//# sourceMappingURL=AttachAddon.js.map \ No newline at end of file