From cb5055d51ac35e4bba3e2f9163dac220ff9a73d9 Mon Sep 17 00:00:00 2001 From: Metin Seylan Date: Sun, 18 Nov 2018 17:31:51 +0300 Subject: [PATCH] added vuex docs --- README.md | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 61310fd..ea7ed4b 100644 --- a/README.md +++ b/README.md @@ -5,12 +5,12 @@

- - - - - - + + + + + +

Vue-Socket.io is a socket.io integration for Vuejs, easy to use, supporting Vuex and component level socket consumer managements

@@ -88,4 +88,28 @@ this.sockets.subscribe('EVENT_NAME', (data) => { }); this.sockets.unsubscribe('EVENT_NAME'); -``` \ No newline at end of file +``` + +#### 🏆 Vuex Integration +

When you set store parameter in installation, `Vue-Socket.io` will sending events to Vuex store, you can use `actions` and `mutations` in same time if you set both prefix for vuex but best way is use just `actions`

+ +``` javascript +import Vue from 'vue' +import Vuex from 'vuex' + +Vue.use(Vuex) + +export default new Vuex.Store({ + state: {}, + mutations: { + ""() { + // do something + } + }, + actions: { + ""() { + // do something + } + } +}) +```