File tree Expand file tree Collapse file tree 2 files changed +10
-10
lines changed
Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ You can find the library on `window.mitt`.
5757``` js
5858import mitt from ' mitt'
5959
60- let emitter = mitt ()
60+ const emitter = mitt ()
6161
6262// listen to an event
6363emitter .on (' foo' , e => console .log (' foo' , e) )
@@ -77,8 +77,8 @@ emitter.off('foo', onFoo) // unlisten
7777### Typescript
7878
7979``` ts
80- import * as mitt from ' mitt' ;
81- let emitter: mitt .Emitter = new mitt ();
80+ import mitt from ' mitt' ;
81+ const emitter: mitt .Emitter = mitt ();
8282```
8383
8484## Examples & Demos
Original file line number Diff line number Diff line change @@ -8,37 +8,37 @@ declare namespace mitt {
88 type Handler = ( event ?: any ) => void ;
99
1010 interface MittStatic {
11- new ( all ?: { [ key : string ] : Handler } ) : Emitter ;
11+ ( all ?: { [ key : string ] : Handler } ) : Emitter ;
1212 }
1313
1414 interface Emitter {
1515 /**
1616 * Register an event handler for the given type.
17- *
17+ *
1818 * @param {string } type Type of event to listen for, or `"*"` for all events.
1919 * @param {Handler } handler Function to call in response to the given event.
20- *
20+ *
2121 * @memberOf Mitt
2222 */
2323 on ( type : string , handler : Handler ) : void ;
2424
2525 /**
2626 * Function to call in response to the given event
27- *
27+ *
2828 * @param {string } type Type of event to unregister `handler` from, or `"*"`
2929 * @param {Handler } handler Handler function to remove.
30- *
30+ *
3131 * @memberOf Mitt
3232 */
3333 off ( type : string , handler : Handler ) : void ;
3434
3535 /**
3636 * Invoke all handlers for the given type.
3737 * If present, `"*"` handlers are invoked prior to type-matched handlers.
38- *
38+ *
3939 * @param {string } type The event type to invoke
4040 * @param {any } [event] An event object, passed to each handler
41- *
41+ *
4242 * @memberOf Mitt
4343 */
4444 emit ( type : string , event ?: any ) : void ;
You can’t perform that action at this time.
0 commit comments