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: '<'
}
};
もう1つのことは、アプリの足場にyeomanを使用していて、禁止されたJSLintがあり、console.log
使用する必要があると言われていますangular.$log
が、それを変更したくないので、ここで問題を理解したいです。