Skip to content

Mitt - some problems #164

Description

@lk101

I found some problems with mitt. Will these problems be considered in the future?

const emitter = mitt();
emitter.on("evt", () => {});
emitter.on("evt", () => { throw "some error." })
emitter.on("evt", () => { /** do something... */ })

while the

emitter.emit("evt");

happen, there is no chance to run the third callback.

Also,

emitter.on("evt", () => { emitter.off("evt") });
emitter.on("evt", () => { /** do something... */});
emitter.on("evt", () => { emitter.off("*") });
emitter.on("*", () => { /** do something... */});
emitter.on("*", () => { /** do something... */});
emitter.on("*", () => { /** do something... */});

while the

emitter.emit("evt");

happen, there is no chance to run the "*" callback, but can run the second "evt" callback.

Also,

mitt not supports

emitter.off(); // off all of the listeners.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions