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/reducers | |
parent | d01db82c0dca352de2d7644c383d388fc3ec0366 (diff) |
Declare setting types
Diffstat (limited to 'src/content/reducers')
-rw-r--r-- | src/content/reducers/setting.ts | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/content/reducers/setting.ts b/src/content/reducers/setting.ts index fa8e8ee..a3dc3aa 100644 --- a/src/content/reducers/setting.ts +++ b/src/content/reducers/setting.ts @@ -1,12 +1,20 @@ import * as actions from '../actions'; +import * as keyUtils from '../../shared/utils/keys'; +import * as operations from '../../shared/operations'; +import { Properties } from '../../shared/Settings'; export interface State { - keymaps: any[]; + keymaps: { key: keyUtils.Key[], op: operations.Operation }[]; + properties: Properties; } -const defaultState = { - // keymaps is and arrays of key-binding pairs, which is entries of Map +const defaultState: State = { keymaps: [], + properties: { + complete: '', + smoothscroll: false, + hintchars: '', + }, }; export default function reducer( @@ -15,7 +23,15 @@ export default function reducer( ): State { switch (action.type) { case actions.SETTING_SET: - return { ...action.value }; + return { + keymaps: Object.entries(action.settings.keymaps).map((entry) => { + return { + key: keyUtils.fromMapKeys(entry[0]), + op: entry[1], + }; + }), + properties: action.settings.properties, + }; default: return state; } |