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

how to monitor the value change in the main process #34

Open
Liupeng8 opened this issue Apr 20, 2019 · 3 comments
Open

how to monitor the value change in the main process #34

Liupeng8 opened this issue Apr 20, 2019 · 3 comments

Comments

@Liupeng8
Copy link

If the operation changes the value in the rendering process, how to monitor the value change in the main process, such as: the computed attribute in vue。

@AshfieldFox
Copy link

Hello, just try :
store.subscribe((mutation, state) => {
console.log(mutation.type)
console.log(mutation.payload)
})

@akodkod
Copy link
Contributor

akodkod commented Aug 29, 2019

#44

@legolaserea
Copy link

Hello, just try :
store.subscribe((mutation, state) => {
console.log(mutation.type)
console.log(mutation.payload)
})

@AshfieldFox maybe this referee is wrong.

I do in my work like below:
first create an instance of store in the main process, like this:

import './path/to/your/store'

and then

store.subscribe((mutation, state) => {
   // Code to be executed after listening for the value change
})

the mutation is the value's related mutation in the store

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

4 participants