diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-05-05 08:03:29 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-05-06 22:17:18 +0900 |
commit | a0882bbceb7ed71d56bf8557620449fbc3f19749 (patch) | |
tree | f2087d44f21dd68fc3584f62cfb9b62ae58bab2b /src/content/actions/setting.ts | |
parent | d01db82c0dca352de2d7644c383d388fc3ec0366 (diff) |
Declare setting types
Diffstat (limited to 'src/content/actions/setting.ts')
-rw-r--r-- | src/content/actions/setting.ts | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/src/content/actions/setting.ts b/src/content/actions/setting.ts index a8f049a..92f8559 100644 --- a/src/content/actions/setting.ts +++ b/src/content/actions/setting.ts @@ -1,29 +1,20 @@ import * as actions from './index'; -import * as keyUtils from '../../shared/utils/keys'; import * as operations from '../../shared/operations'; import * as messages from '../../shared/messages'; +import Settings, { Keymaps } from '../../shared/Settings'; -const reservedKeymaps = { +const reservedKeymaps: Keymaps = { '<Esc>': { type: operations.CANCEL }, '<C-[>': { type: operations.CANCEL }, }; -const set = (value: any): actions.SettingAction => { - let entries: any[] = []; - if (value.keymaps) { - let keymaps = { ...value.keymaps, ...reservedKeymaps }; - entries = Object.entries(keymaps).map((entry) => { - return [ - keyUtils.fromMapKeys(entry[0]), - entry[1], - ]; - }); - } - +const set = (settings: Settings): actions.SettingAction => { return { type: actions.SETTING_SET, - value: { ...value, - keymaps: entries, } + settings: { + ...settings, + keymaps: { ...settings.keymaps, ...reservedKeymaps }, + } }; }; |