aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZach Buttram <[email protected]>2018-09-19 05:37:03 -0700
committerJason Miller <[email protected]>2018-09-19 08:37:03 -0400
commitd08d7821efb479967b7f65bcf43f3187eb97eacf (patch)
tree6b393ac8582715aec7bd8c3d2d120a147682c9d5
parent0f4e8f0d3c0cfe4581edd9e93d3dac0ce994eefb (diff)
Fix Typescript wildcard handler (#76)
* attempt to fix handler typedef for wildcard events * also fix wildcard handler typedef for .off
-rw-r--r--mitt.d.ts3
1 files changed, 3 insertions, 0 deletions
diff --git a/mitt.d.ts b/mitt.d.ts
index 7b3121a..97d017b 100644
--- a/mitt.d.ts
+++ b/mitt.d.ts
@@ -6,6 +6,7 @@ declare module "mitt" {
declare namespace mitt {
type Handler = (event?: any) => void;
+ type WildcardHandler = (type?: string, event?: any) => void;
interface MittStatic {
(all?: {[key: string]: Handler}): Emitter;
@@ -21,6 +22,7 @@ declare namespace mitt {
* @memberOf Mitt
*/
on(type: string, handler: Handler): void;
+ on(type: "*", handler: WildcardHandler): void;
/**
* Function to call in response to the given event
@@ -31,6 +33,7 @@ declare namespace mitt {
* @memberOf Mitt
*/
off(type: string, handler: Handler): void;
+ off(type: "*", handler: WildcardHandler): void;
/**
* Invoke all handlers for the given type.