aboutsummaryrefslogtreecommitdiff
path: root/e2e/lib/SettingRepository.ts
blob: 3bdf6d2cf3c9e87511224d663911d8224fcdee1f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { JSONTextSettings, SettingSource } from '../../src/shared/SettingData';
import Settings from '../../src/shared/settings/Settings';

export default class SettingRepository {
  constructor(
    private readonly browser: any,
  ) {
  }

  async saveJSON(settings: Settings): Promise<void> {
    await this.browser.storage.sync.set({
      settings: {
        source: SettingSource.JSON,
        json:  JSONTextSettings.fromSettings(settings).toJSONText(),
      }
    });
  }
}