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:
authorKayleePop <34007889+KayleePop@users.noreply.github.com>2018-08-26 22:53:56 +0300
committerKayleePop <34007889+KayleePop@users.noreply.github.com>2020-04-15 06:01:47 +0300
commit3393e92166d7049dc84e2d488b4769c668ee3b20 (patch)
tree0791d3c82d0f81f221c7a44193521ed0e3d0b087 /index.js
parent349afeb831c4709c0878346d64c58bf7387e90f2 (diff)
implement store destruction option
Diffstat (limited to 'index.js')
-rw-r--r--index.js12
1 files changed, 8 insertions, 4 deletions
diff --git a/index.js b/index.js
index 135fb93..c67a061 100644
--- a/index.js
+++ b/index.js
@@ -334,18 +334,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 () {