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

Namespaced modules: root actions #941

Merged
merged 6 commits into from
Oct 11, 2017
Merged

Namespaced modules: root actions #941

merged 6 commits into from
Oct 11, 2017

Conversation

Akryum
Copy link
Member

@Akryum Akryum commented Sep 11, 2017

Fix #770

The actions can now be defined with the following notation:

{
  root: true,
  handler (context, payload) { ... }
}
  • Tests
  • Type def

src/store.js Outdated
@@ -287,8 +287,19 @@ function installModule (store, rootState, path, module, hot) {
})

module.forEachAction((action, key) => {
const namespacedType = namespace + key
registerAction(store, namespacedType, action, local)
let finalType, finalAction
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can just write like following?

const type = action.root ? key : namespace + key
const handler = action.handler || action
registerAction(store, type, handler, local)

expected: 'function or object with "handler" function'
}

const assertTypes = {
Copy link
Member

Choose a reason for hiding this comment

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

This is nice assertion approach 👍

@ktsn ktsn added the proposal label Sep 14, 2017
@ktsn ktsn requested a review from yyx990803 September 28, 2017 00:23
@yyx990803 yyx990803 merged commit 73189eb into vuejs:dev Oct 11, 2017
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