# All files / src observer.ts

100% Statements 4/4
100% Branches 2/2
100% Functions 2/2
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16

    167x

    239x
    239x

     import { EventEmitter } from 'eventemitter3';

    /**
     * Simple adapter sub-class of Nodejs-like EventEmitter.
     */
    export class Observer extends EventEmitter {
      /**
       * We simply want to pass along the event-name itself
       * in every call to a handler, which is the purpose of our `trigger` method
       * extending the standard API.
       */
      trigger (event: string, ...data: Array<any>): void {
        this.emit(event, event, ...data);
      }
    }