aboutsummaryrefslogtreecommitdiffstats
path: root/components/script_bindings/webidls/XRSession.webidl
blob: ccd72b187c634925a4485dad584c9e0be31719fc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */

// skip-unless CARGO_FEATURE_WEBXR

// https://immersive-web.github.io/webxr/#xrsession-interface

enum XREnvironmentBlendMode {
  "opaque",
  "additive",
  "alpha-blend",
};

enum XRVisibilityState {
  "visible",
  "visible-blurred",
  "hidden",
};

enum XRInteractionMode {
  "screen-space",
  "world-space",
};

callback XRFrameRequestCallback = undefined (DOMHighResTimeStamp time, XRFrame frame);

[SecureContext, Exposed=Window, Pref="dom_webxr_enabled"]
interface XRSession : EventTarget {
  // Attributes
  readonly attribute XRVisibilityState visibilityState;
  readonly attribute float? frameRate;
  readonly attribute Float32Array? supportedFrameRates;
  [SameObject] readonly attribute XRRenderState renderState;
  [SameObject] readonly attribute XRInputSourceArray inputSources;
  readonly attribute /*FrozenArray<DOMString>*/ any enabledFeatures;
  readonly attribute boolean isSystemKeyboardSupported;

  // Methods
  [Throws] undefined updateRenderState(optional XRRenderStateInit state = {});
  Promise<undefined> updateTargetFrameRate(float rate);
  Promise<XRReferenceSpace> requestReferenceSpace(XRReferenceSpaceType type);

  long requestAnimationFrame(XRFrameRequestCallback callback);
  undefined cancelAnimationFrame(long handle);

  Promise<undefined> end();

  // Events
  attribute EventHandler onend;
  attribute EventHandler onselect;
  attribute EventHandler onsqueeze;
  attribute EventHandler oninputsourceschange;
  attribute EventHandler onselectstart;
  attribute EventHandler onselectend;
  attribute EventHandler onsqueezestart;
  attribute EventHandler onsqueezeend;
  attribute EventHandler onvisibilitychange;
  attribute EventHandler onframeratechange;

  // AR Module
  // Attributes
  readonly attribute XREnvironmentBlendMode environmentBlendMode;
  readonly attribute XRInteractionMode interactionMode;

  // Hit Test Module
  // Methods
  Promise<XRHitTestSource> requestHitTestSource(XRHitTestOptionsInit options);
};