diff options
author | Kaylee <34007889+KayleePop@users.noreply.github.com> | 2020-09-10 21:38:44 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-10 21:38:44 +0300 |
commit | 7aee819796c540df0b247fec1853098f9a591d4c (patch) | |
tree | 6eb6ac35de0fed83e3e2470a3e647645c8bfa240 /index.js | |
parent | 9ae31e5d8a44b98a768971efb7c6b7b386eb9447 (diff) | |
parent | 3393e92166d7049dc84e2d488b4769c668ee3b20 (diff) |
Merge pull request #1364 from KayleePop/destroy
Diffstat (limited to 'index.js')
-rw-r--r-- | index.js | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -335,18 +335,22 @@ class WebTorrent extends EventEmitter { * @param {string|Buffer|Torrent} torrentId * @param {function} cb */ - remove (torrentId, cb) { + remove (torrentId, opts, cb) { + if (typeof opts === 'function') return this.remove(torrentId, null, opts) + this._debug('remove') const torrent = this.get(torrentId) if (!torrent) throw new Error(`No torrent with id ${torrentId}`) - this._remove(torrentId, cb) + this._remove(torrentId, opts, cb) } - _remove (torrentId, cb) { + _remove (torrentId, opts, cb) { + if (typeof opts === 'function') return this._remove(torrentId, null, opts) + const torrent = this.get(torrentId) if (!torrent) return this.torrents.splice(this.torrents.indexOf(torrent), 1) - torrent.destroy(cb) + torrent.destroy(opts, cb) } address () { |