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

Watchers should be a core concept of Vuex #1624

Closed
lwxbr opened this issue Oct 3, 2019 · 1 comment
Closed

Watchers should be a core concept of Vuex #1624

lwxbr opened this issue Oct 3, 2019 · 1 comment

Comments

@lwxbr
Copy link

lwxbr commented Oct 3, 2019

What problem does this feature solve?

This will make the flow of vuex, that is already very intuitive, more easier.

What does the proposed API look like?

In the analogy of component vs vuex:

data => state,
methods => mutations and actions ,
computed properties => getters,
watchers => watchers

The users will not have to use store.$watch, they will create watchers in the Vuex.Store and in modules directly.

The good news is that it will not destroy any existant flow, will only increase a feature that will help the flow of vuex.

This is the model of a module of vuex with watchers:

const state = {};
const getters = {};
const mutations = {};
const actions = {};
const watchers = {};

export default {
    namespaced: true,
	state,
	getters,
	mutations,
	actions,
	watchers,
}
@ktsn
Copy link
Member

ktsn commented Nov 9, 2019

Duplicate of #1219

@ktsn ktsn marked this as a duplicate of #1219 Nov 9, 2019
@ktsn ktsn closed this as completed Nov 9, 2019
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

No branches or pull requests

2 participants