diff options
-rw-r--r-- | docs/api.md | 3 | ||||
-rw-r--r-- | docs/tutorials.md | 6 |
2 files changed, 3 insertions, 6 deletions
diff --git a/docs/api.md b/docs/api.md index 5c7b8f1..bb50e4d 100644 --- a/docs/api.md +++ b/docs/api.md @@ -299,7 +299,6 @@ Here is a user example for browser: const client = new WebTorrent() const magnetURI = 'magnet: ...' const player = document.querySelector('video') -const scope = './' function download (instance) { client.add(magnetURI, torrent => { @@ -310,7 +309,7 @@ function download (instance) { // access individual torrents at /webtorrent/<infoHash> where infoHash is the hash of the torrent }) } -navigator.serviceWorker.register('./sw.min.js', { scope }).then(reg => { +navigator.serviceWorker.register('./sw.min.js', { scope: './' }).then(reg => { const worker = reg.active || reg.waiting || reg.installing function checkState (worker) { return worker.state === 'activated' && download(client.createServer({ controller: reg })) diff --git a/docs/tutorials.md b/docs/tutorials.md index dfe67e9..2d39297 100644 --- a/docs/tutorials.md +++ b/docs/tutorials.md @@ -14,7 +14,6 @@ import WebTorrent from 'webtorrent' const client = new WebTorrent() const torrentId = 'magnet:?xt=urn:btih:08ada5a7a6183aae1e09d831df6748d566095a10&dn=Sintel&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.empire-js.us%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2F&xs=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fsintel.torrent' const player = document.querySelector('video') -const scope = './' function download () { client.add(torrentId, torrent => { @@ -31,7 +30,7 @@ function download () { console.log('Ready to play!') }) } -navigator.serviceWorker.register('./sw.min.js', { scope }).then(reg => { +navigator.serviceWorker.register('./sw.min.js', { scope: './' }).then(reg => { const worker = reg.active || reg.waiting || reg.installing function checkState (worker) { return worker.state === 'activated' && client.createServer({ controller: reg }) && download() @@ -85,7 +84,6 @@ Code example: const client = new WebTorrent() const torrentId = 'magnet:?xt=urn:btih:08ada5a7a6183aae1e09d831df6748d566095a10&dn=Sintel&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.empire-js.us%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2F&xs=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fsintel.torrent' const player = document.querySelector('video') -const scope = './' function download () { client.add(torrentId, torrent => { @@ -97,7 +95,7 @@ function download () { console.log('Ready to play!') }) } -navigator.serviceWorker.register('./sw.min.js', { scope }).then(reg => { +navigator.serviceWorker.register('./sw.min.js', { scope: './' }).then(reg => { const worker = reg.active || reg.waiting || reg.installing function checkState (worker) { return worker.state === 'activated' && client.createServer({ controller: reg }) && download() |