enhance(frontend): ブラウザの互換性向上 (MisskeyIO#257)

This commit is contained in:
まっちゃとーにゅ
2023-11-24 03:26:28 +09:00
committed by GitHub
parent 6157c35f9c
commit 84a7f12e7f
2 changed files with 48 additions and 10 deletions

View File

@@ -3,9 +3,9 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
const canvas = globalThis.OffscreenCanvas && new OffscreenCanvas(1, 1);
// 環境によってはOffscreenCanvasが存在しないため
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
const canvas = typeof OffscreenCanvas !== 'undefined'
? new OffscreenCanvas(1, 1)
: undefined;
const gl = canvas?.getContext('webgl2');
if (gl) {
postMessage({ result: true });