fix: work around missing indexedDB.databases (#2054)
This commit is contained in:
parent
e0827be8c8
commit
c692a1850b
|
@ -6,7 +6,7 @@ import './routes/_utils/forceOnline'
|
|||
import { mark, stop } from './routes/_utils/marks'
|
||||
import { loadPolyfills } from './routes/_utils/polyfills/loadPolyfills'
|
||||
import { loadNonCriticalPolyfills } from './routes/_utils/polyfills/loadNonCriticalPolyfills'
|
||||
import idbReady from 'safari-14-idb-fix'
|
||||
import { idbReady } from './routes/_utils/idbReady'
|
||||
|
||||
Promise.all([idbReady(), loadPolyfills()]).then(() => {
|
||||
mark('sapperStart')
|
||||
|
|
14
src/routes/_utils/idbReady.js
Normal file
14
src/routes/_utils/idbReady.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
import safariIdbReady from 'safari-14-idb-fix'
|
||||
import { isWebKit } from './userAgent/isWebKit'
|
||||
|
||||
// workaround for a safari 14 bug, see https://github.com/jakearchibald/safari-14-idb-fix
|
||||
export async function idbReady () {
|
||||
if (!isWebKit()) {
|
||||
return
|
||||
}
|
||||
if (typeof indexedDB === 'undefined' || !indexedDB.databases) {
|
||||
// fix for https://github.com/jakearchibald/safari-14-idb-fix/pull/2
|
||||
return
|
||||
}
|
||||
await safariIdbReady()
|
||||
}
|
Loading…
Reference in a new issue