fix(workers/blurhash): Don't use OffscreenCanvas (#1398)
This commit is contained in:
parent
03dff1c595
commit
823a7abebf
|
@ -2,7 +2,11 @@ import { decode as decodeBlurHash } from 'blurhash'
|
|||
import registerPromiseWorker from 'promise-worker/register'
|
||||
import { BLURHASH_RESOLUTION as RESOLUTION } from '../_static/blurhash'
|
||||
|
||||
const OFFSCREEN_CANVAS = typeof OffscreenCanvas === 'function'
|
||||
const isChrome = /Chrome/.test(navigator.userAgent)
|
||||
|
||||
// Disabled in Chrome because convertToBlob() is slow
|
||||
// https://github.com/nolanlawson/pinafore/issues/1396
|
||||
const OFFSCREEN_CANVAS = !isChrome && typeof OffscreenCanvas === 'function'
|
||||
? new OffscreenCanvas(RESOLUTION, RESOLUTION) : null
|
||||
const OFFSCREEN_CANVAS_CONTEXT_2D = OFFSCREEN_CANVAS
|
||||
? OFFSCREEN_CANVAS.getContext('2d') : null
|
||||
|
|
Loading…
Reference in a new issue