diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-11-13 19:44:19 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-11-13 19:44:19 +0900 |
commit | c202ab052917794b7d3f7af3413d2d0fcd1b3bba (patch) | |
tree | aa151e12a7eb0bdcc22bc92302f4cf3e0a521319 /src/content | |
parent | 91ea58008c2d7e64ffca4acf20749c8f7b3eb211 (diff) |
fix hot-reload settings
Diffstat (limited to 'src/content')
-rw-r--r-- | src/content/actions/setting.js | 7 | ||||
-rw-r--r-- | src/content/components/common/keymapper.js | 2 | ||||
-rw-r--r-- | src/content/reducers/setting.js | 3 |
3 files changed, 6 insertions, 6 deletions
diff --git a/src/content/actions/setting.js b/src/content/actions/setting.js index 353dd24..0238c71 100644 --- a/src/content/actions/setting.js +++ b/src/content/actions/setting.js @@ -2,21 +2,20 @@ import actions from 'content/actions'; import * as keyUtils from 'shared/utils/keys'; const set = (value) => { - let maps = new Map(); + let entries = []; if (value.keymaps) { - let entries = Object.entries(value.keymaps).map((entry) => { + entries = Object.entries(value.keymaps).map((entry) => { return [ keyUtils.fromMapKeys(entry[0]), entry[1], ]; }); - maps = new Map(entries); } return { type: actions.SETTING_SET, value: Object.assign({}, value, { - keymaps: maps, + keymaps: entries, }) }; }; diff --git a/src/content/components/common/keymapper.js b/src/content/components/common/keymapper.js index 0abbc91..fb8fabe 100644 --- a/src/content/components/common/keymapper.js +++ b/src/content/components/common/keymapper.js @@ -25,7 +25,7 @@ export default class KeymapperComponent { let state = this.store.getState(); let input = state.input; - let keymaps = state.setting.keymaps; + let keymaps = new Map(state.setting.keymaps); let matched = Array.from(keymaps.keys()).filter((mapping) => { return mapStartsWith(mapping, input.keys); diff --git a/src/content/reducers/setting.js b/src/content/reducers/setting.js index a54f5a3..a23027f 100644 --- a/src/content/reducers/setting.js +++ b/src/content/reducers/setting.js @@ -1,7 +1,8 @@ import actions from 'content/actions'; const defaultState = { - keymaps: new Map(), + // keymaps is and arrays of key-binding pairs, which is entries of Map + keymaps: [], }; export default function reducer(state = defaultState, action = {}) { |