Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFeross Aboukhadijeh <feross@feross.org>2015-05-29 22:59:55 +0300
committerFeross Aboukhadijeh <feross@feross.org>2015-05-29 22:59:55 +0300
commit8dfcea0e818dc072202ffef93731e74e16128c8b (patch)
tree83733afe6c8f6f136b923c3a64922eeda5e511b6 /index.js
parent07f0685cbf3ec8a4ddcb9ebac7b8f4343d6787e8 (diff)
moved remote torrent handling into parse-torrent@5.1
Diffstat (limited to 'index.js')
-rw-r--r--index.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/index.js b/index.js
index 62183af..f730bda 100644
--- a/index.js
+++ b/index.js
@@ -121,11 +121,12 @@ Object.defineProperty(WebTorrent.prototype, 'ratio', {
* searching through the `client.torrents` array. Returns `null` if no matching torrent
* found.
*
- * @param {string|Buffer|Object} torrentId
+ * @param {string|Buffer|Object|Torrent} torrentId
* @return {Torrent|null}
*/
WebTorrent.prototype.get = function (torrentId) {
var self = this
+ if (torrentId instanceof Torrent) return torrentId
var parsed = parseTorrent(torrentId)
if (!parsed.infoHash) throw new Error('Invalid torrent identifier')
for (var i = 0, len = self.torrents.length; i < len; i++) {
@@ -260,7 +261,7 @@ WebTorrent.prototype.destroy = function (cb) {
var tasks = self.torrents.map(function (torrent) {
return function (cb) {
- self.remove(torrent.infoHash, cb)
+ self.remove(torrent, cb)
}
})