Initial commit

This commit is contained in:
zhongjin
2020-06-15 10:58:47 +08:00
commit 4f1dfe7564
8590 changed files with 1516878 additions and 0 deletions
@@ -0,0 +1,22 @@
var Backbone = require('backbone');
var NotifierModel = require('./notifier-model');
module.exports = Backbone.Collection.extend({
model: function (attrs, opts) {
return new NotifierModel(attrs, opts);
},
findById: function (id) {
return this.findWhere({id: id});
},
addNotification: function (attrs, options) {
var notification = this._findNotificationByAttrs(attrs);
return notification ? notification.update(attrs) : this.add(attrs, options);
},
_findNotificationByAttrs: function (attrs) {
return this.findWhere({ info: attrs.info });
}
});