app.event.removeAllListeners() }); contains(slist, item).should.be.true; app.event.removeAllListeners() done(); });
/** * Tears down all set timeouts and event listeners. */ destroy() { if (this.fetchSnapshotTimer) { clearTimeout(this.fetchSnapshotTimer); this.fetchSnapshotTimer = null; } this.updaterEvents.removeAllListeners(); }
waiter.on(eventid, function(msg) { setImmediate(function() { result.push(msg) if (input.length === result.length) { done(result) waiter.removeAllListeners(eventid) } }) })
off(name, fn) { this.ee.removeAllListeners(name, fn); }
channel.on('shutdown', function () { channel.emit("broadcast", "", "Chat shutdown"); channel.removeAllListeners("broadcast"); });
// TODO Don't work when called again before previous call is resolved - Need Fix // makeMatch(name, creator) { return new Promise((resolve, reject) => { const onNewMatch = msg => { const { args } = msg; clearTimeout(timeout); this.eventEmitter.removeAllListeners(); const matchRoom = args[0]; const matchId = args[0].split('_').pop(); resolve({ matchId, name, matchRoom, creator }); }; const timeout = setTimeout(() => { this.eventEmitter.removeListener('newMatchCreated', onNewMatch); reject('Timed out'); }, 5000); this.client.say('banchobot', `!mp make ${name}`); this.eventEmitter.on('newMatchCreated', onNewMatch); }); }
componentWillUnmount() { this.event.removeAllListeners(); }
DownloadFileProcessEvent.removeAllListeners('process'); DownloadFileProcessEvent.removeAllListeners('done'); DownloadFileProcessEvent.emit('error', e); return; error = typeof error == 'function' ? error : () => {}; DownloadFileProcessEvent.removeAllListeners('process');
fetch(url).then((response) => { if(response.status != 200) { DownloadProcessEvent.removeAllListeners('process'); DownloadProcessEvent.removeAllListeners('done'); return DownloadProcessEvent.emit('error','web server return status code:' + response.statusCode) readable.on('error', (e) => DownloadProcessEvent.emit('error', e)); }).catch((err) => { DownloadProcessEvent.removeAllListeners('process'); DownloadProcessEvent.removeAllListeners('done'); return DownloadProcessEvent.emit('error','download file process error:' + err); });
emitter.on(`end:${identifier}`, (endMessage) => { response.end(); emitter.removeAllListeners(`header:${identifier}`); emitter.removeAllListeners(`data:${identifier}`); emitter.removeAllListeners(`end:${identifier}`); });
eventEmitter.removeAllListeners();
waiter.on(eventid, function(msg) { setImmediate(function() { result.push(msg) if (result.length === tfuncs.length) { context(result) waiter.removeAllListeners(eventid) } }) })
/** * Tears down all set timeouts and event listeners. */ public destroy(): void { if (this.fetchSnapshotTimer) { clearTimeout(this.fetchSnapshotTimer); this.fetchSnapshotTimer = null; } this.updaterEvents.removeAllListeners(); }
componentWillUnmount() { this.event.removeAllListeners(); }
emitter.on(`end:${identifier}`, (endMessage: IEndMessage) => { response.end(); emitter.removeAllListeners(`header:${identifier}`); emitter.removeAllListeners(`data:${identifier}`); emitter.removeAllListeners(`end:${identifier}`); });