diff options
| -rw-r--r-- | README.md | 5 | ||||
| -rw-r--r-- | src/index.ts | 3 |
2 files changed, 5 insertions, 3 deletions
@@ -20,8 +20,9 @@ - [when](#when) - [off](#off) - [emit](#emit) + - [Caveats](#caveats) - [Contribute](#contribute) -- [Acknowledments](#acknowledments) + - [Acknowledments](#acknowledments) - [License](#license) ## Install @@ -130,7 +131,7 @@ Keep in mind, due to the nature, of the once handlers that self deregister, you If you want to contribute, I would be happy to look in to your PRs. -# Acknowledments +## Acknowledments I would like to thank [Jason Miller](https://jasonformat.com/) (@developit) for developing `mitt`. `nitt` is no more than just `mitt` with a few extras. diff --git a/src/index.ts b/src/index.ts index 3608ae1..722412b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -37,10 +37,11 @@ export default function nitt(all: EventHandlerMap) { * @param {Function} handler Function to call in response to given event */ once(type: string, handler: EventHandler) { - const onceHandler = evt => { + const onceHandler = (evt: any) => { handler(evt); this.off(type, onceHandler); }; + this.on(type, onceHandler); }, |
