From 05c89ec19a8a76e1c7c651475f070fae2f574eb1 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Wed, 9 Jan 2019 09:39:06 +0100 Subject: [PATCH] refactor: split name and args --- src/index.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/index.js b/src/index.js index 3343397..d458837 100644 --- a/src/index.js +++ b/src/index.js @@ -57,14 +57,10 @@ exports.Store = class Store { return { context: { - dispatch: (...args) => { - args[0] = key + args[0] - this.dispatch(...args) - }, - commit: (...args) => { - args[0] = key + args[0] - this.commit(...args) - }, + dispatch: (name, ...args) => + this.dispatch(key + name, ...args), + commit: (name, ...args) => + this.commit(key + name, ...args), // make sure we reuse this proxy _modulesNamespaceMap: this._modulesNamespaceMap, // pass the right state