diff options
| author | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-05-02 14:08:51 +0900 | 
|---|---|---|
| committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-05-05 23:59:59 +0900 | 
| commit | d01db82c0dca352de2d7644c383d388fc3ec0366 (patch) | |
| tree | ff09ebc545ce00192dff9e1119b0c9e2cf92fdef /src/background/domains | |
| parent | 992b3ac65d7fe86ac7bc3b560960c8bcf86bec69 (diff) | |
Types src/content
Diffstat (limited to 'src/background/domains')
| -rw-r--r-- | src/background/domains/Setting.ts | 20 | 
1 files changed, 14 insertions, 6 deletions
diff --git a/src/background/domains/Setting.ts b/src/background/domains/Setting.ts index 106ec0f..b2b1ff2 100644 --- a/src/background/domains/Setting.ts +++ b/src/background/domains/Setting.ts @@ -1,22 +1,30 @@  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 { -  constructor({ source, json, form }) { +  private obj: SettingValue; + +  constructor({ source, json, form }: SettingValue) {      this.obj = {        source, json, form      };    } -  get source() { +  get source(): string {      return this.obj.source;    } -  get json() { +  get json(): string {      return this.obj.json;    } -  get form() { +  get form(): any {      return this.obj.form;    } @@ -33,11 +41,11 @@ export default class Setting {      return { ...settingsValues.valueFromJson(DefaultSettings.json), ...value };    } -  serialize() { +  serialize(): SettingValue {      return this.obj;    } -  static deserialize(obj) { +  static deserialize(obj: SettingValue): Setting {      return new Setting({ source: obj.source, json: obj.json, form: obj.form });    }  | 
