Skip to content

Commit

Permalink
Remove the navigation event from the explainer
Browse files Browse the repository at this point in the history
Requested by @NellWaliczek. This is for the sake of clarifying things
for TAG review if we don’t get a better solution in place before they
look at the explainer, since we know this ISN’T the right way to handle
this. Ideally we’ll put it back in with #256 or a similar PR.
  • Loading branch information
toji committed Jul 22, 2017
1 parent 0cea0c1 commit 4a3543a
Showing 1 changed file with 0 additions and 22 deletions.
22 changes: 0 additions & 22 deletions explainer.md
Original file line number Diff line number Diff line change
Expand Up @@ -515,27 +515,6 @@ vrSession.addEventListener('resetpose', vrSessionEvent => {
});
```
### Page navigation
WebVR applications can, like any web page, link to other pages. In the context of a VR scene this is handled by setting `window.location` to the desired URL when the user performs some action. If the page being linked to is not VR-capable the user will either have to remove the VR device to view it (which the UA should explicitly instruct them to do) or the page could be shown as a 2D page in a VR browser.
If the page being navigated to is VR capable, however, it's frequently desirable to allow the user to immediately begin using a VR session for that page as well, so that the user feels as though they are navigating through a single continuous VR experience. To achieve this the page can handle the `navigate` event, fired on the `navigator.vr` object. This event provides a `VRSession` for the `VRDevice` that the previous page was presenting to.
The `VRDevice` and `VRSession` must not retain any state set by the previous page, and need not make any guarantees about consistency of pose data between pages. They should maintain the same general implementation between pages for basic usage consistency. For example: The user agent should not switch users from the Oculus SDK to OpenVR between pages, or from Daydream to Cardboard, even though in both cases the users device could technically be used with either.
To indicate to indicate that you wish to continue presenting VR content on this page the handler must call `event.preventDefault()`.
```js
navigator.vr.addEventListener('navigate', vrSessionEvent => {
vrSessionEvent.preventDefault();
vrSession = vrSessionEvent.session;
vrDevice = vrSession.device;

// Ensure content is loaded and begin drawing.
onDrawFrame();
});
```
## Appendix A: I don’t understand why this is a new API. Why can’t we use…
### `DeviceOrientation` Events
Expand Down Expand Up @@ -578,7 +557,6 @@ partial interface Navigator {
interface VR : EventTarget {
attribute EventHandler ondeviceconnect;
attribute EventHandler ondevicedisconnect;
attribute EventHandler onnavigate;

Promise<sequence<VRDevice>> getDevices();
};
Expand Down

0 comments on commit 4a3543a

Please sign in to comment.