mirror of https://github.com/keeweb/keeweb.git
33 lines
827 B
JavaScript
33 lines
827 B
JavaScript
import { Model } from 'framework/model';
|
|
import { SettingsStore } from 'comp/settings/settings-store';
|
|
|
|
class RuntimeDataModel extends Model {
|
|
constructor() {
|
|
super();
|
|
this.on('change', () => this.save());
|
|
}
|
|
|
|
load() {
|
|
return SettingsStore.load('runtime-data').then(data => {
|
|
if (data) {
|
|
if (data.cookies) {
|
|
// we're not using cookies here now
|
|
delete data.cookies;
|
|
}
|
|
this.set(data, { silent: true });
|
|
}
|
|
});
|
|
}
|
|
|
|
save() {
|
|
SettingsStore.save('runtime-data', this);
|
|
}
|
|
}
|
|
|
|
RuntimeDataModel.defineModelProperties({}, { extensions: true });
|
|
|
|
const instance = new RuntimeDataModel();
|
|
window.RuntimeDataModel = instance;
|
|
|
|
export { instance as RuntimeDataModel };
|