konjure_web/capabilities.rs
1use wasm_bindgen::prelude::*;
2
3/// Observed browser APIs and support queries, not permission grants or hardware proof.
4///
5/// wasm-bindgen generates the JavaScript getters and TypeScript declaration from
6/// these Rust fields. Browser hosts must free the returned owned snapshot.
7#[wasm_bindgen(getter_with_clone)]
8#[derive(Clone, Debug, Default, PartialEq, Eq)]
9pub struct BrowserCapabilities {
10 /// Whether the browser considers this a secure context.
11 #[wasm_bindgen(readonly, js_name = secureContext)]
12 pub secure_context: bool,
13 /// Whether the WebAssembly object is present.
14 #[wasm_bindgen(readonly)]
15 pub wasm: bool,
16 /// Whether a temporary WebGL 2 context could be created.
17 #[wasm_bindgen(readonly)]
18 pub webgl2: bool,
19 /// Whether `navigator.gpu` is present; no adapter or device was requested.
20 #[wasm_bindgen(readonly)]
21 pub webgpu: bool,
22 /// Result of `isSessionSupported("immersive-ar")`.
23 #[wasm_bindgen(readonly, js_name = immersiveAr)]
24 pub immersive_ar: bool,
25 /// Result of `isSessionSupported("immersive-vr")`.
26 #[wasm_bindgen(readonly, js_name = immersiveVr)]
27 pub immersive_vr: bool,
28 /// Diagnostic when the WebGL probe failed rather than returning no context.
29 #[wasm_bindgen(readonly, js_name = webglError)]
30 pub webgl_error: Option<String>,
31 /// Diagnostics for rejected or malformed XR support queries, with mode labels.
32 #[wasm_bindgen(readonly, js_name = xrError)]
33 pub xr_error: Option<String>,
34}