diff options
Diffstat (limited to 'src/background/domains')
-rw-r--r-- | src/background/domains/GlobalMark.ts | 3 | ||||
-rw-r--r-- | src/background/domains/Setting.ts | 59 |
2 files changed, 2 insertions, 60 deletions
diff --git a/src/background/domains/GlobalMark.ts b/src/background/domains/GlobalMark.ts index 0964373..1ae912e 100644 --- a/src/background/domains/GlobalMark.ts +++ b/src/background/domains/GlobalMark.ts @@ -1,6 +1,7 @@ -export interface GlobalMark { +export default interface GlobalMark { readonly tabId: number; readonly url: string; readonly x: number; readonly y: number; + // eslint-disable-next-line semi } diff --git a/src/background/domains/Setting.ts b/src/background/domains/Setting.ts deleted file mode 100644 index b2b1ff2..0000000 --- a/src/background/domains/Setting.ts +++ /dev/null @@ -1,59 +0,0 @@ -import DefaultSettings from '../../shared/settings/default'; -import * as settingsValues from '../../shared/settings/values'; - -type SettingValue = { - source: string, - json: string, - form: any -} - -export default class Setting { - private obj: SettingValue; - - constructor({ source, json, form }: SettingValue) { - this.obj = { - source, json, form - }; - } - - get source(): string { - return this.obj.source; - } - - get json(): string { - return this.obj.json; - } - - get form(): any { - return this.obj.form; - } - - value() { - let value = JSON.parse(DefaultSettings.json); - if (this.obj.source === 'json') { - value = settingsValues.valueFromJson(this.obj.json); - } else if (this.obj.source === 'form') { - value = settingsValues.valueFromForm(this.obj.form); - } - if (!value.properties) { - value.properties = {}; - } - return { ...settingsValues.valueFromJson(DefaultSettings.json), ...value }; - } - - serialize(): SettingValue { - return this.obj; - } - - static deserialize(obj: SettingValue): Setting { - return new Setting({ source: obj.source, json: obj.json, form: obj.form }); - } - - static defaultSettings() { - return new Setting({ - source: DefaultSettings.source, - json: DefaultSettings.json, - form: {}, - }); - } -} |