Skip to content
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

support $on multi event - #4856 #4860

Merged
merged 1 commit into from
Feb 15, 2017
Merged

support $on multi event - #4856 #4860

merged 1 commit into from
Feb 15, 2017

Conversation

Kingwl
Copy link
Member

@Kingwl Kingwl commented Feb 6, 2017

Copy link
Member

@kazupon kazupon left a comment

Choose a reason for hiding this comment

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

@Kingwl
Copy link
Member Author

Kingwl commented Feb 6, 2017

@kazupon oh sorry...

// instead of a hash lookup
if (hookRE.test(event)) {
vm._hasHookEvent = true
const events: Array<string> = Array.isArray(event) ? event : [event]
Copy link
Member

Choose a reason for hiding this comment

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

I'd prefer using for loop only when it's an Array instead of always turning it into an Array.

In the loop you can just do this.$on(events[i], fn)

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@yyx990803 yyx990803 merged commit 8bb6c2b into vuejs:dev Feb 15, 2017
@yyx990803
Copy link
Member

Thanks!

@Kingwl Kingwl deleted the multi-event-on branch February 16, 2017 02:21
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.

3 participants