Fix offscreencanvas undefined (#88)
* Suppress ReferenceError on some environments (i.e. older iOS) * fix * fix * lint --------- Co-authored-by: yuriha-chan <yuriha.tsuchiura@gmail.com>
This commit is contained in:
parent
e88617e3c3
commit
91af2d7b06
|
@ -1,7 +1,13 @@
|
||||||
const canvas = new OffscreenCanvas(1, 1);
|
try {
|
||||||
const gl = canvas.getContext('webgl2');
|
// throw ReferenceError in Safari <= 16.3
|
||||||
if (gl) {
|
const canvas = new OffscreenCanvas(1, 1);
|
||||||
postMessage({ result: true });
|
const gl = canvas.getContext('webgl2');
|
||||||
} else {
|
if (gl) {
|
||||||
|
postMessage({ result: true });
|
||||||
|
} else {
|
||||||
|
postMessage({ result: false });
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
// assert(e instanceof ReferenceError)
|
||||||
postMessage({ result: false });
|
postMessage({ result: false });
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue