keeweb/app/scripts/collections/file-info-collection.js

36 lines
792 B
JavaScript
Raw Normal View History

2015-12-06 21:32:41 +01:00
'use strict';
var Backbone = require('backbone'),
FileInfoModel = require('../models/file-info-model'),
SettingsStore = require('../comp/settings-store');
var FileInfoCollection = Backbone.Collection.extend({
model: FileInfoModel,
initialize: function () {
},
load: function () {
var data = SettingsStore.load('file-info');
if (data) {
this.reset(data, {silent: true});
}
},
save: function () {
SettingsStore.save('file-info', this.toJSON());
},
getLast: function () {
this.max(function(file) { return file.get('openDate'); });
}
});
FileInfoCollection.load = function() {
var coll = new FileInfoCollection();
coll.load();
return coll;
};
module.exports = FileInfoCollection;