From 6d5c7983d1fe01e27bc73d07ceb05b7e29a96ff8 Mon Sep 17 00:00:00 2001 From: Slava Date: Wed, 13 Feb 2019 11:37:02 +0200 Subject: [PATCH] move string concatenation out of loop (#189) --- 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);