diff --git a/src/background/infrastructures/ContentMessageClient.ts b/src/background/infrastructures/ContentMessageClient.ts index 2983409..4d2284c 100644 --- a/src/background/infrastructures/ContentMessageClient.ts +++ b/src/background/infrastructures/ContentMessageClient.ts @@ -22,14 +22,14 @@ export default class ContentMessageClient { return enabled as any as boolean; } - toggleAddonEnabled(tabId: number): Promise { - return browser.tabs.sendMessage(tabId, { + async toggleAddonEnabled(tabId: number): Promise { + await browser.tabs.sendMessage(tabId, { type: messages.ADDON_TOGGLE_ENABLED, }); } - scrollTo(tabId: number, x: number, y: number): Promise { - return browser.tabs.sendMessage(tabId, { + async scrollTo(tabId: number, x: number, y: number): Promise { + await browser.tabs.sendMessage(tabId, { type: messages.TAB_SCROLL_TO, x, y, diff --git a/src/shared/Settings.ts b/src/shared/Settings.ts index 2a392df..d338e2a 100644 --- a/src/shared/Settings.ts +++ b/src/shared/Settings.ts @@ -21,13 +21,6 @@ export default interface Settings { blacklist: string[]; } -const DefaultProperties: Properties = PropertyDefs.defs.reduce( - (o: {[name: string]: PropertyDefs.Type}, def) => { - o[def.name] = def.defaultValue; - return o; - }, {}) as Properties; - - export const keymapsValueOf = (o: any): Keymaps => { return Object.keys(o).reduce((keymaps: Keymaps, key: string): Keymaps => { let op = operations.valueOf(o[key]); @@ -82,7 +75,7 @@ export const propertiesValueOf = (o: any): Properties => { } } return { - ...DefaultProperties, + ...PropertyDefs.defaultValues, ...o, }; }; diff --git a/src/shared/property-defs.ts b/src/shared/property-defs.ts index 6315030..fec9f80 100644 --- a/src/shared/property-defs.ts +++ b/src/shared/property-defs.ts @@ -48,3 +48,9 @@ export const defs: Def[] = [ 'which are completed at the open page', 'sbh'), ]; + +export const defaultValues = { + hintchars: 'abcdefghijklmnopqrstuvwxyz', + smoothscroll: false, + complete: 'sbh', +};