aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/webidls/XRSession.webidl
blob: f22918d469d7d128ad627827d29a37282700da11 (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
/* 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/. */

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

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

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

[SecureContext, Exposed=Window, Pref="dom.webxr.enabled"]
interface XRSession : EventTarget {
  // // Attributes
  readonly attribute XRSessionMode mode;
  // readonly attribute XRPresentationContext outputContext;
  readonly attribute XREnvironmentBlendMode environmentBlendMode;

  readonly attribute XRRenderState renderState;
  readonly attribute XRSpace viewerSpace;

  // // Methods
  Promise<XRReferenceSpace> requestReferenceSpace(XRReferenceSpaceOptions options);

  // FrozenArray<XRInputSource> getInputSources();

  Promise<void> updateRenderState(optional XRRenderStateInit state);
  long requestAnimationFrame(XRFrameRequestCallback callback);
  void cancelAnimationFrame(long handle);

  // Promise<void> end();

  // // Events
  // attribute EventHandler onblur;
  // attribute EventHandler onfocus;
  // attribute EventHandler onend;
  // attribute EventHandler onselect;
  // attribute EventHandler oninputsourceschange;
  // attribute EventHandler onselectstart;
  // attribute EventHandler onselectend;
};

enum XRReferenceSpaceType {
  "identity",
  "stationary",
  "bounded",
  "unbounded"
};

dictionary XRReferenceSpaceOptions {
  required XRReferenceSpaceType type;
  XRStationaryReferenceSpaceSubtype subtype;
};