fix(pipe): dispatch "disconnected" event when browser is terminated (#3472)

This commit is contained in:
Andrey Lushnikov
2018-10-31 16:31:29 -07:00
committed by GitHub
parent 9800b2c3c2
commit 3dd5c28f90
2 changed files with 13 additions and 1 deletions

View File

@@ -27,7 +27,11 @@ class PipeTransport {
this._pipeWrite = pipeWrite;
this._pendingMessage = '';
this._eventListeners = [
helper.addEventListener(pipeRead, 'data', buffer => this._dispatch(buffer))
helper.addEventListener(pipeRead, 'data', buffer => this._dispatch(buffer)),
helper.addEventListener(pipeRead, 'close', () => {
if (this.onclose)
this.onclose.call(null);
})
];
this.onmessage = null;
this.onclose = null;