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:
Diffstat (limited to 'index.js')
-rw-r--r--index.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/index.js b/index.js
index e7b56a8..1476004 100644
--- a/index.js
+++ b/index.js
@@ -222,7 +222,11 @@ class WebTorrent extends EventEmitter {
this.workerPortCount++
port.postMessage(response)
})
- cb(this.serviceWorker)
+ // test if browser supports cancelling sw Readable Streams
+ fetch(`${this.serviceWorker.scriptURL.slice(0, this.serviceWorker.scriptURL.lastIndexOf('/') + 1).slice(window.location.origin.length)}webtorrent/cancel/`).then(res => {
+ res.body.cancel()
+ })
+ cb(null, this.serviceWorker)
}
get downloadSpeed () { return this._downloadSpeed() }