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>2016-01-15 04:06:05 +0300
committerFeross Aboukhadijeh <feross@feross.org>2016-01-15 04:06:05 +0300
commit6f89456317a5383d07e5041b049497c9f5151335 (patch)
tree9de23ea297310315fb8adc6711de6802fa4f48d1 /index.js
parent816d6972d87a77d2569e3e311d6aa031e1fc369c (diff)
style
Diffstat (limited to 'index.js')
-rw-r--r--index.js9
1 files changed, 3 insertions, 6 deletions
diff --git a/index.js b/index.js
index 754b4f0..7b12d56 100644
--- a/index.js
+++ b/index.js
@@ -163,11 +163,8 @@ WebTorrent.prototype.download = function (torrentId, opts, ontorrent) {
var self = this
if (self.destroyed) throw new Error('client is destroyed')
if (typeof opts === 'function') return self.add(torrentId, null, opts)
+ opts = opts ? extend(opts) : {}
debug('add')
- if (!opts) opts = {}
- else opts = extend(opts)
-
- opts.client = self
var torrent = self.get(torrentId)
@@ -179,6 +176,7 @@ WebTorrent.prototype.download = function (torrentId, opts, ontorrent) {
if (torrent.ready) process.nextTick(_ontorrent)
else torrent.on('ready', _ontorrent)
} else {
+ opts.client = self
torrent = new Torrent(torrentId, opts)
self.torrents.push(torrent)
@@ -210,9 +208,8 @@ WebTorrent.prototype.seed = function (input, opts, onseed) {
var self = this
if (self.destroyed) throw new Error('client is destroyed')
if (typeof opts === 'function') return self.seed(input, null, opts)
+ opts = opts ? extend(opts) : {}
debug('seed')
- if (!opts) opts = {}
- else opts = extend(opts)
// When seeding from filesystem, initialize store from that path (avoids a copy)
if (typeof input === 'string') opts.path = path.dirname(input)