Fix offscreencanvas undefined (#11017)

* Suppress ReferenceError on some environments (i.e. older iOS)

* fix

* fix

* lint

* adopt suggestion by acid-chicken
This commit is contained in:
Yuriha 2023-06-26 10:45:14 +09:00 committed by GitHub
parent d23ad8b511
commit 58a898dfe0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -1,5 +1,5 @@
const canvas = new OffscreenCanvas(1, 1);
const gl = canvas.getContext('webgl2');
const canvas = globalThis.OffscreenCanvas && new OffscreenCanvas(1, 1);
const gl = canvas?.getContext('webgl2');
if (gl) {
postMessage({ result: true });
} else {