Skip to content

Commit cff6a7a

Browse files
ljharbCopilot
andauthored
fixup: Update apps/site/hooks/react-client/useDetectOS.ts
Co-authored-by: Copilot <[email protected]> Signed-off-by: Jordan Harband <[email protected]>
1 parent db7d83c commit cff6a7a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

apps/site/hooks/react-client/useDetectOS.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,18 @@ type UserOSState = {
1919
function isAppleSilicon() {
2020
try {
2121
// Best guess if the device uses Apple Silicon: https://stackoverflow.com/a/65412357
22-
const w = document.createElement('canvas').getContext('webgl');
23-
if (w == null) {
22+
const webglContext = document.createElement('canvas').getContext('webgl');
23+
if (webglContext == null) {
2424
return false;
2525
}
26-
const d = w.getExtension('WEBGL_debug_renderer_info');
27-
const g = (d && w.getParameter(d.UNMASKED_RENDERER_WEBGL)) || '';
28-
if (g.match(/Apple/) && !g.match(/Apple GPU/)) {
26+
const debugInfo = webglContext.getExtension('WEBGL_debug_renderer_info');
27+
const renderer = (debugInfo && webglContext.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL)) || '';
28+
if (renderer.match(/Apple/) && !renderer.match(/Apple GPU/)) {
2929
return true;
3030
}
3131

3232
if (
33-
w.getSupportedExtensions()?.includes('WEBGL_compressed_texture_s3tc_srgb')
33+
webglContext.getSupportedExtensions()?.includes('WEBGL_compressed_texture_s3tc_srgb')
3434
) {
3535
return true;
3636
}

0 commit comments

Comments
 (0)