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>2020-10-29 05:22:48 +0300
committerFeross Aboukhadijeh <feross@feross.org>2020-10-29 05:22:48 +0300
commitf6121c311b754591a737aec0d3abce299b4908c8 (patch)
tree44e8a8d8d137cbd37b8a9297e32806fec3ac79c1 /index.js
parent8b8a93ed85a7546ce30123044e89443d6c62c624 (diff)
standard
Diffstat (limited to 'index.js')
-rw-r--r--index.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/index.js b/index.js
index 312ebe7..5b69b1c 100644
--- a/index.js
+++ b/index.js
@@ -207,7 +207,7 @@ class WebTorrent extends EventEmitter {
* @param {Object} opts torrent-specific options
* @param {function=} ontorrent called when the torrent is ready (has metadata)
*/
- add (torrentId, opts = {}, ontorrent) {
+ add (torrentId, opts = {}, ontorrent = () => {}) {
if (this.destroyed) throw new Error('client is destroyed')
if (typeof opts === 'function') [opts, ontorrent] = [{}, opts]
@@ -223,7 +223,7 @@ class WebTorrent extends EventEmitter {
const onReady = () => {
if (this.destroyed) return
- if (typeof ontorrent === 'function') ontorrent(torrent)
+ ontorrent(torrent)
this.emit('torrent', torrent)
}