1
0
mirror of https://github.com/keeweb/keeweb.git synced 2024-06-21 07:06:39 +02:00
keeweb/app/scripts/models/runtime-data-model.js
2019-08-18 10:17:09 +02:00

31 lines
751 B
JavaScript

const Backbone = require('backbone');
const SettingsStore = require('../comp/settings-store');
const RuntimeDataModel = Backbone.Model.extend({
defaults: {},
initialize() {
this.listenTo(this, '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.attributes);
}
});
RuntimeDataModel.instance = new RuntimeDataModel();
module.exports = RuntimeDataModel;