aboutsummaryrefslogtreecommitdiff
path: root/src/background/repositories/persistent-setting.js
blob: 247ea6f2ea951d969683377d3d7ac51bf032da3d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import Setting from '../domains/setting';

export default class SettingRepository {
  save(settings) {
    return browser.storage.local.set({ settings: settings.serialize() });
  }

  async load() {
    let { settings } = await browser.storage.local.get('settings');
    if (!settings) {
      return null;
    }
    return Setting.deserialize(settings);
  }
}