2 Object.defineProperty(exports, "__esModule", { value: true });
4 constructor(socket, options) {
5 this._disposables = [];
7 this._socket.binaryType = 'arraybuffer';
8 this._bidirectional = (options && options.bidirectional === false) ? false : true;
11 this._disposables.push(addSocketListener(this._socket, 'message', ev => {
13 terminal.write(typeof data === 'string' ? data : new Uint8Array(data));
15 if (this._bidirectional) {
16 this._disposables.push(terminal.onData(data => this._sendData(data)));
18 this._disposables.push(addSocketListener(this._socket, 'close', () => this.dispose()));
19 this._disposables.push(addSocketListener(this._socket, 'error', () => this.dispose()));
22 this._disposables.forEach(d => d.dispose());
25 if (this._socket.readyState !== 1) {
28 this._socket.send(data);
31 exports.AttachAddon = AttachAddon;
32 function addSocketListener(socket, type, handler) {
33 socket.addEventListener(type, handler);
39 socket.removeEventListener(type, handler);
43 //# sourceMappingURL=AttachAddon.js.map