1
0
mirror of https://github.com/keeweb/keeweb.git synced 2024-06-26 07:39:04 +02:00
keeweb/app/scripts/models/runtime-data-model.js
2020-05-13 16:37:35 +02:00

29 lines
676 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) {
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 };