all files / src/ generic-event.ts

100% Statements 4/4
100% Branches 0/0
100% Functions 3/3
100% Lines 4/4
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33                                                         
 
/**
 * GenericEvent is the base class for classes containing event data.
 */
export class GenericEvent {
 
  /**
   * Whether no further event listeners should be triggered.
   *
   * @type {boolean}
   */
  private propagationStopped: boolean = false;
 
  /**
   * Returns whether further event listeners should be triggered.
   *
   * @returns {boolean}
   */
  public isPropagationStopped(): boolean {
    return this.propagationStopped;
  }
 
  /**
   * Stops the propagation of the event to further event listeners.
   *
   * If multiple event listeners are connected to the same event, no
   * further event listener will be triggered once any trigger calls
   * stopPropagation().
   */
  public stopPropagation(): void {
    this.propagationStopped = true;
  }
}