mirror of
https://github.com/nolanlawson/pinafore
synced 2025-02-01 06:16:47 +01:00
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…
x
Reference in New Issue
Block a user