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-05-08 20:21:42 +0300
committerFeross Aboukhadijeh <feross@feross.org>2016-05-08 20:21:42 +0300
commit47d181f809bf19b669c62457f7e8b45d72246b21 (patch)
tree59c41144fb16a3b8560d5b88ff78ed32ee006509 /index.js
parent587f3adaf83c761c8cea30d62d3e68bc359ab31d (diff)
Move tracker options into `opts.tracker`
Closes #649 Based on a PR by @nkittsteiner. #791
Diffstat (limited to 'index.js')
-rw-r--r--index.js19
1 files changed, 16 insertions, 3 deletions
diff --git a/index.js b/index.js
index 2947888..2b8f188 100644
--- a/index.js
+++ b/index.js
@@ -68,12 +68,24 @@ function WebTorrent (opts) {
self.listening = false
self.torrentPort = opts.torrentPort || 0
self.dhtPort = opts.dhtPort || 0
- self.tracker = opts.tracker !== undefined ? opts.tracker : true
+ self.tracker = opts.tracker !== undefined ? opts.tracker : {}
self.torrents = []
self.maxConns = Number(opts.maxConns) || 55
- self._rtcConfig = opts.rtcConfig
- self._wrtc = opts.wrtc || global.WRTC // to support `webtorrent-hybrid` package
+ if (self.tracker) {
+ if (typeof self.tracker !== 'object') self.tracker = {}
+ if (opts.rtcConfig) {
+ // TODO: remove in v1
+ console.warn('WebTorrent: opts.rtcConfig is deprecated. Use opts.tracker.rtcConfig instead')
+ self.tracker.rtcConfig = opts.rtcConfig
+ }
+ if (opts.wrtc) {
+ // TODO: remove in v1
+ console.warn('WebTorrent: opts.wrtc is deprecated. Use opts.tracker.wrtc instead')
+ self.tracker.wrtc = opts.wrtc // to support `webtorrent-hybrid` package
+ }
+ if (!self.tracker.wrtc) self.tracker.wrtc = global.WRTC
+ }
if (typeof TCPPool === 'function') {
self._tcpPool = new TCPPool(self)
@@ -197,6 +209,7 @@ WebTorrent.prototype.get = function (torrentId) {
return null
}
+// TODO: remove in v1
WebTorrent.prototype.download = function (torrentId, opts, ontorrent) {
console.warn('WebTorrent: client.download() is deprecated. Use client.add() instead')
return this.add(torrentId, opts, ontorrent)