something with web

This commit is contained in:
YouROK
2020-11-12 15:48:32 +03:00
parent bba9d89346
commit 4645e7226e
7 changed files with 252 additions and 37 deletions

View File

@@ -0,0 +1,47 @@
(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;
})();