import { EventEmitter } from 'events' ; export class FakeEvent implements Event { readonly bubbles : boolean = false ; readonly cancelable : boolean = false ; readonly composed : boolean = false ; readonly currentTarget : EventTarget | null = null ; readonly defaultPrevented : boolean = false ; readonly isTrusted : boolean = false ; readonly srcElement : EventTarget | null = null ; readonly target : EventTarget | null = null ; readonly timeStamp : number = 1234 ; type : string ; cancelBubble = false ; returnValue = false ; constructor ( type ) { this . type = type ; } composedPath ( ) { return [ ] ; } initEvent ( ) { return ; } preventDefault ( ) { return ; } stopImmediatePropagation ( ) { return ; } stopPropagation ( ) { return ; } readonly AT_TARGET : number = 0 ; readonly BUBBLING_PHASE : number = 1 ; readonly CAPTURING_PHASE : number = 2 ; readonly NONE : number = 3 ; readonly eventPhase : number = this . NONE ; } export class FakeEventEmitter implements EventTarget { private emitter = new EventEmitter ( ) ; addEventListener ( type , listener ) { this . emitter . on ( type , listener as ( ) => void ) ; } removeEventListener ( type , listener ) { this . emitter . off ( type , listener as ( ) => void ) ; } dispatchEvent ( event ) { this . emitter . emit ( event . type , event ) ; return true ; } }