Skip to content

Commit

Permalink
feat(diagnostics): check if WebAssembly is supported
Browse files Browse the repository at this point in the history
  • Loading branch information
mman committed Jul 22, 2024
1 parent 8c861ee commit 2064dd4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/app/Marine2/components/views/DiagnosticsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,19 @@ const getDeviceDiagnostics = (windowSize: { width?: number; height?: number }) =
property: translate("diagnostics.device.viewportHeight"),
value: (windowSize.height ?? window.innerHeight) + "px",
},
{
property: translate("diagnostics.device.isWebAssemblySupported"),
value: `${checkIfWebAssemblyIsSupported()}`,
},
]
}

const checkIfWebAssemblyIsSupported = () => {
// Check for WebAssembly presence
if (typeof WebAssembly === "object" && typeof WebAssembly.instantiate === "function") {
return true
}
return false
}

export default observer(DiagnosticsView)
3 changes: 2 additions & 1 deletion src/app/locales/languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@
"device": "Device",
"userAgent": "User agent",
"viewportHeight": "Viewport height",
"viewportWidth": "Viewport width"
"viewportWidth": "Viewport width",
"isWebAssemblySupported": "WebAssembly supported"
},
"diagnostics": "Diagnostics"
},
Expand Down

0 comments on commit 2064dd4

Please sign in to comment.