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

feat: subscribeAction #960

Merged
merged 1 commit into from
Oct 11, 2017
Merged

feat: subscribeAction #960

merged 1 commit into from
Oct 11, 2017

Conversation

deini
Copy link
Contributor

@deini deini commented Sep 19, 2017

Allows to listen dispatched actions

After feedback from #929 so we can implement #908

API is as suggested by @ktsn

function actionLoggerPlugin(store) {
  store.subscribeAction(({ type, payload }, state) => {
    console.log(`Before dispatching "${type}" with ${JSON.stringify(payload)}`
  })
}

const store = new Vuex.Store({
  // ...
  plugins: [actionLoggerPlugin]
})

Allows to listen dispatched actions
@deini
Copy link
Contributor Author

deini commented Sep 21, 2017

Made some changes to the built-in Logger plugin to play a bit more with the idea.

image

Not sure if I should include those changes in this PR since I'm not sure if this is something you guys want to support out of the box or would prefer going with a 3rd party actionLoggerPlugin.

Changes are here if anyone is interested.

@smithyj
Copy link

smithyj commented May 11, 2018

You are listening to the start of dispatch distribution,How can listening to the end of dispatch distribution?

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