Skip to content
Myr

mitt.d.ts

This file

Path

mitt.d.ts

46 lines · 1.1 KiB · TypeScript

Last changed by

Typescript definitions (#25)Severinbefore adoptiond63b350

History of this file

Take it

Typescript definitions (#25)Severinbefore adoptiond63b350

lines 1–46why, one step back
1declare var mitt: mitt.MittStatic;
23declare module "mitt" {4 export = mitt;5}67declare namespace mitt {8 type Handler = (event?: any) => void;910 interface MittStatic {11 new(all?: {[key: string]: Handler}): Emitter;12 }1314 interface Emitter {15 /**16 * Register an event handler for the given type.17 * 18 * @param {string} type Type of event to listen for, or `"*"` for all events.19 * @param {Handler} handler Function to call in response to the given event.20 * 21 * @memberOf Mitt22 */23 on(type: string, handler: Handler): void;2425 /**26 * Function to call in response to the given event27 * 28 * @param {string} type Type of event to unregister `handler` from, or `"*"`29 * @param {Handler} handler Handler function to remove.30 * 31 * @memberOf Mitt32 */33 off(type: string, handler: Handler): void;3435 /**36 * Invoke all handlers for the given type.37 * If present, `"*"` handlers are invoked prior to type-matched handlers.38 * 39 * @param {string} type The event type to invoke40 * @param {any} [event] An event object, passed to each handler41 * 42 * @memberOf Mitt43 */44 emit(type: string, event?: any): void;45 }46}