aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Miller <[email protected]>2017-02-25 15:55:51 -0500
committerJason Miller <[email protected]>2017-02-25 15:55:51 -0500
commit5363bf07dd4ace4c510d4b85f8d4ac3a33cf63b5 (patch)
treeb1489a0591c74c890ac18826790b9e466aefb2bc
parent454011654f831d9d70cb434fadd606483d26cf60 (diff)
Let's keep `all` as an argument for now to avoid a semver breaking change
-rw-r--r--src/index.js8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/index.js b/src/index.js
index c4147c1..051f972 100644
--- a/src/index.js
+++ b/src/index.js
@@ -2,11 +2,10 @@
* @name mitt
* @returns {Mitt}
*/
-export default function mitt () {
- let all = Object.create(null)
- let ret = {
- all,
+export default function mitt(all) {
+ all = all || Object.create(null);
+ return {
/**
* Register an event handler for the given type.
*
@@ -49,5 +48,4 @@ export default function mitt () {
return ret;
}
};
- return ret;
}