当我尝试在 webtorrent 的功能中记录一些数据时遇到问题。
我想记录this.client.add的一些值,但我无权访问。
对这里发生的事情有所了解?
import Webtorrent from 'webtorrent';
class PlaylistController {
/** @ngInject */
constructor($http, $log) {
this.log = $log;
this.client = new Webtorrent();
$http
.get('app/playlist/playlist.json')
.then(response => {
this.Torrent = response.data;
});
}
addTorrent(magnetUri) {
this.log.log(magnetUri);
this.client.add(magnetUri, function (torrent) {
// Got torrent metadata!
this.log.log('Client is downloading:', torrent.infoHash);
torrent.files.forEach(file => {
this.log(file);
});
});
this.log.log('sda');
this.log.log(this.client);
}
}
export const playlist = {
templateUrl: "app/playlist/playlist.html",
controller: PlaylistController,
bindings: {
playlist: '<'
}
};
另一件事是我使用 yeoman 作为我的应用程序的脚手架,它有 JSLintconsole.log
禁止使用,它说你必须使用angular.$log
,但我不想改变它,我想了解这里的问题。