Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(diagnostics): check if WebAssembly is supported #390

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -116,7 +116,8 @@
"device": "Device",
"userAgent": "User agent",
"viewportHeight": "Viewport height",
"viewportWidth": "Viewport width"
"viewportWidth": "Viewport width",
"isWebAssemblySupported": "WebAssembly supported"
},
"diagnostics": "Diagnostics"
},
Expand Down
Loading