aboutsummaryrefslogtreecommitdiff
path: root/e2e/lib/SettingRepository.ts
blob: 9d5d5aab124dc27afd7650d93de92d7218e2c544 (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.local.set({
      settings: {
        source: SettingSource.JSON,
        json:  JSONTextSettings.fromSettings(settings).toJSONText(),
      }
    });
  }
}