aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortunnckoCore <[email protected]>2017-01-18 02:35:13 +0200
committertunnckoCore <[email protected]>2017-01-18 02:35:13 +0200
commitf4c60f4dd35fb875649c99b854bbb5c3aac72fdb (patch)
tree3c110825af6f4b361b4e171dc793e88e99b737a3 /src
parente814a573d827be5ebf9d3015ae606780d3f22eb3 (diff)
remove "drop support for emitting multiple args" thing as per https://github.com/developit/mitt/pull/19#issuecomment-273344689
Diffstat (limited to 'src')
-rw-r--r--src/index.js9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/index.js b/src/index.js
index a67efb2..c4147c1 100644
--- a/src/index.js
+++ b/src/index.js
@@ -39,14 +39,13 @@ export default function mitt () {
* If present, `"*"` handlers are invoked prior to type-matched handlers.
*
* @param {String} type The event type to invoke
- * @param {Any} [arg1] A value (first argument), passed to each handler
- * @param {Any} [arg2] A value (second argument), passed to each handler
+ * @param {Any} [evt] Any value (object is recommended and powerful), passed to each handler
* @return {Object} the `mitt` instance for chaining
* @memberof mitt
*/
- emit(type, arg1, arg2) {
- (all[type] || []).map((handler) => { handler(arg1, arg2); });
- (all['*'] || []).map((handler) => { handler(type, arg1, arg2); });
+ emit(type, evt) {
+ (all[type] || []).map((handler) => { handler(evt); });
+ (all['*'] || []).map((handler) => { handler(type, evt); });
return ret;
}
};