Files
TorrServerJellyfin/src/server/web/pages/template/html/main.js
2020-11-12 15:48:32 +03:00

47 lines
1.1 KiB
JavaScript

(function() {
const Torrent = Backbone.Model.extend({
defaults: function() {
return {
title: "",
torr: {},
url:"/torrents"
};
},
remove: function() {
this.destroy();
},
fetch: function (){
const collection = this;
getTorrent(this.torr.hash, function (torr){
console.log(torr);
collection.reset(torr);
})
}
});
var TorrentList = Backbone.Collection.extend({
model: Torrent,
update: function(){
listTorrent(function(torrs){
// torrs.forEach(tr=>
//
// )
Torrents.create({title:""});
console.log(Torrents);
},function (error) {
console.log(error);
});
}
});
var AppView = Backbone.View.extend({
el: $("#torrents"),
initialize: function() {
Torrents.update();
},
});
var Torrents = new TorrentList;
var App = new AppView;
})();