From cb30d25014efaf5cb709c7e2ee4154b1beaa0fd9 Mon Sep 17 00:00:00 2001 From: slav Date: Tue, 12 Feb 2019 11:38:12 +0200 Subject: [PATCH] move string concatenation out of loop --- src/emitter.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/emitter.js b/src/emitter.js index ed4e868..8ae2dbf 100644 --- a/src/emitter.js +++ b/src/emitter.js @@ -91,11 +91,13 @@ export default class EventEmitter{ if(this.store && this.store._actions){ + let prefixed_event = this.actionPrefix + event; + for (let key in this.store._actions) { let action = key.split('/').pop(); - if(action === this.actionPrefix+event) { + if(action === prefixed_event) { Logger.info(`Dispatching Action: ${key}, Data:`, args); @@ -107,11 +109,13 @@ export default class EventEmitter{ if(this.mutationPrefix) { + let prefixed_event = this.mutationPrefix + event; + for (let key in this.store._mutations) { let mutation = key.split('/').pop(); - if(mutation === this.mutationPrefix+event) { + if(mutation === prefixed_event) { Logger.info(`Commiting Mutation: ${key}, Data:`, args);