Ignore noisy webgl params (#1016)

* `isContextLost` is particularly noisy, being called almost constantly by e.g. Figma to check whether there's a need to re initialize a canvas

Juice10: We could perhaps look at 5cd49f6cbc/lib/lib.dom.d.ts (L14578)  via https://stackoverflow.com/questions/60150251/how-to-import-an-interface-from-lib-dom-d-ts

* Apply formatting changes

Co-authored-by: eoghanmurray <eoghanmurray@users.noreply.github.com>
This commit is contained in:
Eoghan Murray
2026-04-01 12:00:00 +08:00
committed by GitHub
parent f43168ba06
commit 56ef2fc175

View File

@@ -24,6 +24,18 @@ function patchGLPrototype(
const props = Object.getOwnPropertyNames(prototype);
for (const prop of props) {
if (
//prop.startsWith('get') || // e.g. getProgramParameter, but too risky
[
'isContextLost',
'canvas',
'drawingBufferWidth',
'drawingBufferHeight',
].includes(prop)
) {
// skip read only propery/functions
continue;
}
try {
if (typeof prototype[prop as keyof typeof prototype] !== 'function') {
continue;