Skip to content

Conversation

zigomir
Copy link
Contributor

@zigomir zigomir commented Apr 4, 2016

Proposal on how to fix #121. Feedback appreciated.

return function vuexBoundAction (...args) {
return action.call(this, store, ...args)
if (Function.prototype.isPrototypeOf(action)) {
Copy link
Member

Choose a reason for hiding this comment

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

I think just typeof action === 'function' is simpler.

*/

function makeBoundAction (store, action) {
function makeBoundAction (store, action, key) {
return function vuexBoundAction (...args) {
Copy link
Member

Choose a reason for hiding this comment

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

actually, we should do the typeof action check and warn in makeBoundAction before returning the bound action. This way the user gets the warning right at instance creation time instead of when they actually call the action.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right! I just pushed a fix.

@yyx990803 yyx990803 merged commit e1940c0 into vuejs:master Apr 8, 2016
@yyx990803
Copy link
Member

👍

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.

2 participants