How to use the eventemitter2.call function in eventemitter2

To help you get started, we’ve selected a few eventemitter2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ditojs / dito / packages / server / src / lib / EventEmitter.js View on Github external
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)
        }
      }
    }
  }

eventemitter2

A feature-rich Node.js event emitter implementation with namespaces, wildcards, TTL, async listeners and browser/worker support.

MIT
Latest version published 2 years ago

Package Health Score

82 / 100
Full package analysis