Skip to content

Include tiny-emitter in events API migration strategy #494

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 18, 2020

Conversation

yuripave
Copy link
Contributor

@yuripave yuripave commented Sep 18, 2020

Description of Problem

In the migration guide, it suggest using mitt to migrate existing event hubs, but its interface is incompatible with Vue 2 where:

  1. mitt's emit doesn't support variadic arguments that $emits supports
  2. mitt doesn't support $once

Proposed Solution

I suggest to include tiny-emitter which its interface is fully compatible with Vue 2 $on, $off and $once, and its emit method do support variadic arguments.

Additional Information

Closes #493

@@ -58,6 +58,6 @@ We removed `$on`, `$off` and `$once` methods from the instance completely. `$emi

## Migration Strategy

Existing event hubs can be replaced by using an external library implementing the event emitter interface, for example [mitt](https://github.com/developit/mitt).
Existing event hubs can be replaced by using an external library implementing the event emitter interface, for example [tiny-emitter](https://github.com/scottcorgan/tiny-emitter).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: would you mind if we leave both of them here? So people could make the choice and docs won't feel like we're promoting a certain library (we definitely made this mistake with mitt)?

Suggested change
Existing event hubs can be replaced by using an external library implementing the event emitter interface, for example [tiny-emitter](https://github.com/scottcorgan/tiny-emitter).
Existing event hubs can be replaced by using an external library implementing the event emitter interface, for example [mitt](https://github.com/developit/mitt) or [tiny-emitter](https://github.com/scottcorgan/tiny-emitter).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NataliaTepluhina make sense and updated the PR.

Copy link
Member

@NataliaTepluhina NataliaTepluhina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yuripave thank you for bringing this! I've left a small suggestion for your consideration

@yuripave yuripave changed the title Update events API migration strategy to tiny-emitter Include tiny-emitter in events API migration strategy Sep 18, 2020
Copy link
Member

@NataliaTepluhina NataliaTepluhina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yuripave thank you for the super fast fix! Happy to merge 🎉

@NataliaTepluhina NataliaTepluhina merged commit cf59d27 into vuejs:master Sep 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Include tiny-emitter in events API migration strategy
2 participants