Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
setupEmitter(events, options) {
EventEmitter2.call(this, {
delimiter: ':',
wildcard: false,
newListener: false,
maxListeners: 0,
...options
})
for (const key in events) {
for (const part of key.split(',')) {
const event = part.trim()
for (const callback of asArray(events[key])) {
this.on(event, callback)
}
}
}
}