MCPcopy
hub / github.com/MetinSeylan/Vue-Socket.io / dispatchStore

Method dispatchStore

src/emitter.js:92–134  ·  view source on GitHub ↗

* dispatching vuex actions * @param event * @param args

(event, args)

Source from the content-addressed store, hash-verified

90 * @param args
91 */
92 dispatchStore(event, args){
93
94 if(this.store && this.store._actions){
95
96 let prefixed_event = this.actionPrefix + event;
97
98 for (let key in this.store._actions) {
99
100 let action = key.split('/').pop();
101
102 if(action === prefixed_event) {
103
104 Logger.info(`Dispatching Action: ${key}, Data:`, args);
105
106 this.store.dispatch(key, args);
107
108 }
109
110 }
111
112 if(this.mutationPrefix) {
113
114 let prefixed_event = this.mutationPrefix + event;
115
116 for (let key in this.store._mutations) {
117
118 let mutation = key.split('/').pop();
119
120 if(mutation === prefixed_event) {
121
122 Logger.info(`Commiting Mutation: ${key}, Data:`, args);
123
124 this.store.commit(key, args);
125
126 }
127
128 }
129
130 }
131
132 }
133
134 }
135
136}

Callers 1

emitMethod · 0.95

Calls 1

infoMethod · 0.80

Tested by

no test coverage detected