You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Readarr/UI/Mixins/backbone.signalr.mixin.js

36 lines
874 B

'use strict';
define(
[
'signalR'
], function () {
_.extend(Backbone.Collection.prototype, {
11 years ago
bindSignalR: function () {
11 years ago
var collection = this;
11 years ago
var processMessage = function (options) {
11 years ago
var model = new collection.model(options.resource, {parse: true});
collection.add(model, {merge: true});
console.log(options.action + ": %O", options.resource);
};
11 years ago
require(
[
11 years ago
'app'
], function (app) {
collection.listenTo(app.vent, 'server:' + collection.url.replace('/api/', ''), processMessage)
});
return this;
},
unbindSignalR: function () {
}});
});