diff options
| author | Jack Franklin <[email protected]> | 2020-05-26 22:45:53 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-05-26 17:45:53 -0400 |
| commit | be5237f301b1059ffff9e1e795fd66594644892a (patch) | |
| tree | c5cae9f5aefeb481dcd88264b2c48c8f248ad42c /README.md | |
| parent | cfd246c8fa9f6e255b63cb98a832b6501cfaa23d (diff) | |
Migrate to TypeScript and use Map (#99)
Migrate to TypeScript & Microbundle, move to Map for event handler storage
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 34 |
1 files changed, 17 insertions, 17 deletions
@@ -95,13 +95,19 @@ const emitter: mitt.Emitter = mitt(); <!-- Generated by documentation.js. Update this documentation by updating the source code. --> -### mitt +#### Table of Contents -Mitt: Tiny (~200b) functional event emitter / pubsub. +- [mitt](#mitt) +- [on](#on) + - [Parameters](#parameters) +- [off](#off) + - [Parameters](#parameters-1) +- [emit](#emit) + - [Parameters](#parameters-2) -**Parameters** +### mitt -- `all` **EventHandlerMap** +Mitt: Tiny (~200b) functional event emitter / pubsub. Returns **Mitt** @@ -109,18 +115,18 @@ Returns **Mitt** Register an event handler for the given type. -**Parameters** +#### Parameters -- `type` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Type of event to listen for, or `"*"` for all events +- `type` **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) \| [symbol](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Symbol))** Type of event to listen for, or `"*"` for all events - `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** Function to call in response to given event ### off Remove an event handler for the given type. -**Parameters** +#### Parameters -- `type` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Type of event to unregister `handler` from, or `"*"` +- `type` **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) \| [symbol](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Symbol))** Type of event to unregister `handler` from, or `"*"` - `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** Handler function to remove ### emit @@ -128,11 +134,11 @@ Remove an event handler for the given type. Invoke all handlers for the given type. If present, `"*"` handlers are invoked after type-matched handlers. -_Note: Manually firing "*" handlers is not supported._ +Note: Manually firing "\*" handlers is not supported. -**Parameters** +#### Parameters -- `type` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The event type to invoke +- `type` **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) \| [symbol](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Symbol))** The event type to invoke - `evt` **Any?** Any value (object is recommended and powerful), passed to each handler ## Contribute @@ -140,12 +146,6 @@ _Note: Manually firing "*" handlers is not supported._ First off, thanks for taking the time to contribute! Now, take a moment to be sure your contributions make sense to everyone else. -Development Start: - -This project is typed with Flow Type annotations. To ensure you have the proper typings for this project run - -`flow-typed install` - ### Reporting Issues Found a problem? Want a new feature? First of all see if your issue or idea has [already been reported](../../issues). |
