From 991b2f0a8280c31b93ad91d6a215b74183417352 Mon Sep 17 00:00:00 2001 From: Florrie Date: Sat, 11 Jul 2020 16:22:01 -0300 Subject: support queue controls over socket clients --- general-util.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'general-util.js') diff --git a/general-util.js b/general-util.js index 0a81cdc..e352960 100644 --- a/general-util.js +++ b/general-util.js @@ -310,3 +310,17 @@ const parseOptions = async function(options, optionDescriptorMap) { parseOptions.handleDashless = Symbol() module.exports.parseOptions = parseOptions + +module.exports.silenceEvents = function(emitter, eventsToSilence, callback) { + const oldEmit = emitter.emit + + emitter.emit = function(event, ...data) { + if (!eventsToSilence.includes(event)) { + oldEmit.apply(emitter, [event, ...data]) + } + } + + callback() + + emitter.emit = oldEmit +} -- cgit 1.3.0-6-gf8a5