// Both close and finish should trigger unpipe, but only once. function onclose() { dest.removeListener( 'finish', onfinish ); unpipe(); }
function once (emitter, name) { return new Promise((resolve, reject) => { if (name !== 'error') emitter.once('error', reject) emitter.once(name, (...args) => { emitter.removeListener('error', reject) resolve(...args) }) }) }
// scoped function handleReadyToShow (ev) { if (ev.sender === window) { window.show() electron.ipcMain.removeListener('ready-to-show', handleReadyToShow) } }
function onfinish() { debug('onfinish'); dest.removeListener('close', onclose); unpipe(); }
componentWillUnmount() { this.props.session.dispatcher.removeListener(WEBSOCKET_MESSAGE_TYPES.ZWAVE.NODE_ADDED, this.nodeAddedListener); this.props.session.dispatcher.removeListener(WEBSOCKET_MESSAGE_TYPES.ZWAVE.NODE_READY, this.nodeReadyListener); this.props.session.dispatcher.addListener(WEBSOCKET_MESSAGE_TYPES.ZWAVE.NODE_REMOVED, this.nodeRemovedListener); }
unsubscribe(channel) { if (!this.subscriptions.has(channel)) { return; } this.emitter.removeListener(channel, this.subscriptions.get(channel)); this.subscriptions.delete(channel); }
let off = () => { if (stdin.isTTY) stdin.setRawMode(isRaw); stdin.removeListener('keypress', on); rl.pause(); rl.close(); }
let addMultilineHandler = ({rli}) => { nodeLineListener = rli.listeners('line')[0]; rli.removeListener('line', nodeLineListener); rli.on('line', (cmd) => { promptData += cmd + EOL; }); }
componentWillUnmount() { this.props.session.dispatcher.removeListener( WEBSOCKET_MESSAGE_TYPES.DEVICE.NEW_STATE, this.updateDeviceStateWebsocket ); }
function freeSocketErrorListener() { var socket = this; socket.destroy(); socket.emit('agentRemove'); socket.removeListener('error', freeSocketErrorListener); }
function unsubscribe(channel: string) { if (!subscriptions.has(channel)) { //console.log('No channel to unsub from'); return; } //console.log('unsub ', channel); emitter.removeListener(channel, subscriptions.get(channel)); subscriptions.delete(channel); }
function g() { this.removeListener(type, g); if (!fired) { fired = true; listener.apply(this, arguments); } }
// remove all the event listeners that were added. function cleanup() { source.removeListener('data', ondata); dest.removeListener('drain', ondrain); source.removeListener('end', onend); source.removeListener('close', onclose); source.removeListener('error', onerror); dest.removeListener('error', onerror); source.removeListener('end', cleanup); source.removeListener('close', cleanup); dest.removeListener('close', cleanup); }
componentWillUnmount() { this.props.session.dispatcher.removeListener( WEBSOCKET_MESSAGE_TYPES.DEVICE.NEW_STRING_STATE, this.updateDeviceStateWebsocket ); }
function g() { this.removeListener(type, g); if (!fired) { fired = true; listener.apply(this, arguments); } }