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 'lib/file.js')
-rw-r--r--lib/file.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/file.js b/lib/file.js
index cbbc484..c5e5f1e 100644
--- a/lib/file.js
+++ b/lib/file.js
@@ -206,7 +206,7 @@ class File extends EventEmitter {
if (typeof window === 'undefined') throw new Error('browser-only method')
if (!this._serviceWorker) throw new Error('No worker registered')
if (this._serviceWorker.state !== 'activated') throw new Error('Worker isn\'t activated')
- const workerPath = this._serviceWorker.scriptURL.substr(0, this._serviceWorker.scriptURL.lastIndexOf('/') + 1).slice(window.location.origin.length)
+ const workerPath = this._serviceWorker.scriptURL.slice(0, this._serviceWorker.scriptURL.lastIndexOf('/') + 1).slice(window.location.origin.length)
const url = `${workerPath}webtorrent/${this._torrent.infoHash}/${encodeURI(this.path)}`
cb(null, url)
}
@@ -215,7 +215,7 @@ class File extends EventEmitter {
if (typeof window === 'undefined') throw new Error('browser-only method')
if (!this._serviceWorker) throw new Error('No worker registered')
if (this._serviceWorker.state !== 'activated') throw new Error('Worker isn\'t activated')
- const workerPath = this._serviceWorker.scriptURL.substr(0, this._serviceWorker.scriptURL.lastIndexOf('/') + 1).slice(window.location.origin.length)
+ const workerPath = this._serviceWorker.scriptURL.slice(0, this._serviceWorker.scriptURL.lastIndexOf('/') + 1).slice(window.location.origin.length)
elem.src = `${workerPath}webtorrent/${this._torrent.infoHash}/${encodeURI(this.path)}`
cb(null, elem)
}