1
0
mirror of https://github.com/keeweb/keeweb.git synced 2024-06-27 07:45:08 +02:00
keeweb/app/scripts/models/runtime-data-model.js
2017-04-08 18:31:38 +02:00

27 lines
628 B
JavaScript

const Backbone = require('backbone');
const SettingsStore = require('../comp/settings-store');
const RuntimeDataModel = Backbone.Model.extend({
defaults: {},
initialize: function() {
this.listenTo(this, 'change', this.save);
},
load: function() {
return SettingsStore.load('runtime-data').then(data => {
if (data) {
this.set(data, {silent: true});
}
});
},
save: function() {
SettingsStore.save('runtime-data', this.attributes);
}
});
RuntimeDataModel.instance = new RuntimeDataModel();
module.exports = RuntimeDataModel;