-
Notifications
You must be signed in to change notification settings - Fork 496
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
Emit socket event from vuex store #47
Comments
+1 |
2 similar comments
+1 |
+1 |
Temporarily we can use |
+1 |
+1 |
+1 |
@gil0mendes my mutation breaks as soon as i add the hacky line to send the data down the wire and i'm getting a strange I'm using vue 2.3.4, vuex 2.3.1 and vue-socket.io 2.1.1 May i'm doing something wrong or is it broken in the meantime? thanks [types.MY_UPDATE] (state, { index, value }) {
state.slots[index].value = value
(new Vue()).$socket.emit('my_update', { index: value })
}, |
@joernroeder Hey, the error is really strange. Can you test for me throw the event on an action, instead? Btw, that kind of things is more recommended use on actions. |
+1 |
While the in
in
That's how the |
@Dverlik your approroach looks simple and clean – going to use it in the future. thanks for sharing! |
Originally posted this in #85 but I thought I'd post it here too in case anyone on the chain might find it useful. Your mutations and actions can reference the root Vue instance via
Avoids instantiating a new Vue instance every time you need to emit an event. |
Hi again, can you give an example how to emit an event from a vuex store action
The text was updated successfully, but these errors were encountered: