How to use the eventemitter3.prefixed function in eventemitter3

To help you get started, we’ve selected a few eventemitter3 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 c58 / marsdb / lib / AsyncEventEmitter.js View on Github external
emitAsync(event, a1, a2, a3, a4, a5) {
    const prefix = EventEmitter.prefixed;
    const evt = prefix ? prefix + event : event;

    if (!this._events || !this._events[evt]) {
      return Promise.resolve();
    }

    let i;
    const listeners = this._events[evt];
    const len = arguments.length;
    let args;

    if ('function' === typeof listeners.fn) {
      if (listeners.once) {
        this.removeListener(event, listeners.fn, undefined, true);
      }

eventemitter3

EventEmitter3 focuses on performance while maintaining a Node.js AND browser compatible interface.

MIT
Latest version published 2 years ago

Package Health Score

79 / 100
Full package analysis