blob: ea04037bbd8cf99e51781675fa26eaab1a239ab1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
export function createOffscreenCanvas({
width,
height,
}: {
width: number;
height: number;
}): OffscreenCanvas | HTMLCanvasElement {
try {
return new OffscreenCanvas(width, height);
} catch {
const canvas = document.createElement("canvas");
canvas.width = width;
canvas.height = height;
return canvas;
}
}
|