From aaf62576c1c75c0eb657891e6bf45d3f84036ccd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=BE=E3=81=A3=E3=81=A1=E3=82=83=E3=81=A8=E3=83=BC?= =?UTF-8?q?=E3=81=AB=E3=82=85?= <17376330+u1-liquid@users.noreply.github.com> Date: Tue, 19 Sep 2023 12:50:47 +0900 Subject: [PATCH] Fix OffscreenCanvas undefined (MisskeyIO#165) --- packages/frontend/src/workers/test-webgl2.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/frontend/src/workers/test-webgl2.ts b/packages/frontend/src/workers/test-webgl2.ts index b3501cfe50..1f3f640e6b 100644 --- a/packages/frontend/src/workers/test-webgl2.ts +++ b/packages/frontend/src/workers/test-webgl2.ts @@ -3,8 +3,10 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -const canvas = globalThis.OffscreenCanvas && new OffscreenCanvas(1, 1); -const gl = canvas.getContext('webgl2'); +const canvas = typeof OffscreenCanvas !== 'undefined' + ? new OffscreenCanvas(1, 1) + : undefined; +const gl = canvas?.getContext('webgl2'); if (gl) { postMessage({ result: true }); } else {