Skip to content

Commit

Permalink
Remove the canvas
Browse files Browse the repository at this point in the history
  • Loading branch information
Hacksore committed Nov 18, 2023
1 parent cf68419 commit ce0c7e8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@
export const isWebGLAvailable = () => {
try {
const canvas = document.createElement("canvas");
return !!(window.WebGLRenderingContext && (canvas.getContext("webgl") || canvas.getContext("experimental-webgl")));
const hasWebGl = !!(
window.WebGLRenderingContext &&
(canvas.getContext("webgl") || canvas.getContext("experimental-webgl"))
);

// cleanup the canvas
canvas.remove();

return hasWebGl;
} catch (e) {
return false;
}
Expand Down

0 comments on commit ce0c7e8

Please sign in to comment.