Fix EventEmitter#off not existing

box-drawing
cpsdqs 7 years ago
parent cc28a69d85
commit 91c17e0fc3
Signed by untrusted user: cpsdqs
GPG Key ID: 3F59586BB7448DD1
  1. 4
      js/term/demo.js

@ -696,7 +696,7 @@ let demoshIndex = {
let write = data => this.emit('write', data) let write = data => this.emit('write', data)
child.on('write', write) child.on('write', write)
child.on('exit', code => { child.on('exit', code => {
child.off('write', write) child.removeListener('write', write)
this.destroy() this.destroy()
}) })
child.run(...args) child.run(...args)
@ -853,7 +853,7 @@ class DemoShell {
let write = data => this.terminal.write(data) let write = data => this.terminal.write(data)
this.child.on('write', write) this.child.on('write', write)
this.child.on('exit', code => { this.child.on('exit', code => {
if (this.child) this.child.off('write', write) if (this.child) this.child.removeListener('write', write)
this.child = null this.child = null
this.prompt(!code) this.prompt(!code)
}) })

Loading…
Cancel
Save