export declare type EventHandler = {
  id: string
  name: string
  timeout: Number
}

export declare type PublishResult = {
  id: string
  time: number
  delay: number
}

export interface Handler {
  name: string
  callbacks: Array<Function>
  timeout: Number
  push(handler: Function): void
  setTimeout(ms: Number): void
  invoke(event: any, context: any): Promise<any[]>
}

export declare interface Events {
  on(name: string, ...args: any[]): Handler | null
  publish(name, ...args: any[]): Promise<PublishResult>
}

declare const events: Events
export default events
