aboutsummaryrefslogtreecommitdiff
path: root/src/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/index.js')
-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;
}