split serviceWorker and streamDownload capabilities
This commit is contained in:
parent
81cf84b131
commit
61299dd8ea
|
@ -75,6 +75,7 @@ async function polyfillStreams() {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async function capabilities() {
|
export default async function capabilities() {
|
||||||
|
const serviceWorker = 'serviceWorker' in navigator;
|
||||||
let crypto = await checkCrypto();
|
let crypto = await checkCrypto();
|
||||||
const nativeStreams = checkStreams();
|
const nativeStreams = checkStreams();
|
||||||
let polyStreams = false;
|
let polyStreams = false;
|
||||||
|
@ -91,11 +92,10 @@ export default async function capabilities() {
|
||||||
return {
|
return {
|
||||||
account,
|
account,
|
||||||
crypto,
|
crypto,
|
||||||
|
serviceWorker,
|
||||||
streamUpload: nativeStreams || polyStreams,
|
streamUpload: nativeStreams || polyStreams,
|
||||||
streamDownload:
|
streamDownload:
|
||||||
nativeStreams &&
|
nativeStreams && serviceWorker && browserName() !== 'safari',
|
||||||
'serviceWorker' in navigator &&
|
|
||||||
browserName() !== 'safari',
|
|
||||||
multifile: nativeStreams || polyStreams
|
multifile: nativeStreams || polyStreams
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,8 +28,9 @@ if (process.env.NODE_ENV === 'production') {
|
||||||
(async function start() {
|
(async function start() {
|
||||||
const app = routes(choo());
|
const app = routes(choo());
|
||||||
const capa = await capabilities();
|
const capa = await capabilities();
|
||||||
if (capa.streamDownload) {
|
if (capa.serviceWorker) {
|
||||||
navigator.serviceWorker.register('/serviceWorker.js');
|
await navigator.serviceWorker.register('/serviceWorker.js');
|
||||||
|
await navigator.serviceWorker.ready;
|
||||||
}
|
}
|
||||||
|
|
||||||
const translate = await getTranslator(LOCALE);
|
const translate = await getTranslator(LOCALE);
|
||||||
|
|
Loading…
Reference in New Issue