File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change 11// @flow
22// An event handler can take an optional event argument
33// and should not return a value
4- type EventHandler = ( event ? : any ) => void ;
4+ type EventHandler = ( typeOrEvent ? : string | any , event ? : any ) => void ;
55// An array of all currently registered event handlers for a type
66type EventHandlerList = Array < EventHandler > ;
77// A map of event types and their corresponding event handlers.
@@ -49,7 +49,7 @@ export default function mitt(all: EventHandlerMap) {
4949 * @param {Any } [evt] Any value (object is recommended and powerful), passed to each handler
5050 * @memberof mitt
5151 */
52- emit ( type : string , evt : any ) {
52+ emit ( type : string , evt ? : any ) {
5353 ( all [ type ] || [ ] ) . map ( ( handler ) => { handler ( evt ) ; } ) ;
5454 ( all [ '*' ] || [ ] ) . map ( ( handler ) => { handler ( type , evt ) ; } ) ;
5555 }
You can’t perform that action at this time.
0 commit comments