import { EventEmitter } from "events" ; export class UserScriptEvent extends EventEmitter { constructor ( ) { super ( ) ; this . setMaxListeners ( 0 ) ; } subscribe ( event , handler ) { this . addListener ( event , handler ) ; return ( ) => { this . removeListener ( event , handler ) ; } ; } dispatch ( event , ... args ) { this . emit ( event , ... args ) ; } }