Fix type checkings
This commit is contained in:
parent
217b5a0e61
commit
5197f22f9b
3 changed files with 11 additions and 12 deletions
|
@ -22,14 +22,14 @@ export default class ContentMessageClient {
|
||||||
return enabled as any as boolean;
|
return enabled as any as boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleAddonEnabled(tabId: number): Promise<void> {
|
async toggleAddonEnabled(tabId: number): Promise<void> {
|
||||||
return browser.tabs.sendMessage(tabId, {
|
await browser.tabs.sendMessage(tabId, {
|
||||||
type: messages.ADDON_TOGGLE_ENABLED,
|
type: messages.ADDON_TOGGLE_ENABLED,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
scrollTo(tabId: number, x: number, y: number): Promise<void> {
|
async scrollTo(tabId: number, x: number, y: number): Promise<void> {
|
||||||
return browser.tabs.sendMessage(tabId, {
|
await browser.tabs.sendMessage(tabId, {
|
||||||
type: messages.TAB_SCROLL_TO,
|
type: messages.TAB_SCROLL_TO,
|
||||||
x,
|
x,
|
||||||
y,
|
y,
|
||||||
|
|
|
@ -21,13 +21,6 @@ export default interface Settings {
|
||||||
blacklist: string[];
|
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 => {
|
export const keymapsValueOf = (o: any): Keymaps => {
|
||||||
return Object.keys(o).reduce((keymaps: Keymaps, key: string): Keymaps => {
|
return Object.keys(o).reduce((keymaps: Keymaps, key: string): Keymaps => {
|
||||||
let op = operations.valueOf(o[key]);
|
let op = operations.valueOf(o[key]);
|
||||||
|
@ -82,7 +75,7 @@ export const propertiesValueOf = (o: any): Properties => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
...DefaultProperties,
|
...PropertyDefs.defaultValues,
|
||||||
...o,
|
...o,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -48,3 +48,9 @@ export const defs: Def[] = [
|
||||||
'which are completed at the open page',
|
'which are completed at the open page',
|
||||||
'sbh'),
|
'sbh'),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
export const defaultValues = {
|
||||||
|
hintchars: 'abcdefghijklmnopqrstuvwxyz',
|
||||||
|
smoothscroll: false,
|
||||||
|
complete: 'sbh',
|
||||||
|
};
|
||||||
|
|
Reference in a new issue