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

Events to promises #104

Merged
merged 2 commits into from
Dec 23, 2024
Merged
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
22 changes: 13 additions & 9 deletions explainer.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
- [Fallback content](#fallback-content)
- [DOM API](#dom-api)
- [JavaScript API](#javascript-api)
- [Resource Promises](#resource-promises)
- [DOM Events](#dom-events)
- [DOM Actions](#dom-actions)
- [Visual presentation control](#visual-presentation-control)
Expand Down Expand Up @@ -242,6 +243,18 @@ when playback has been successfully started.
* `pause()`: A method that attempts to pause the playback of a model's animation. If the model is already paused
this method will have no effect.

## Resource Promises

* `ready`: Resolved when the model's source file has been loaded and processed, such that the
bounding box information is available and the animation duration, if present, is known. The
Promise is rejected if the source file is unable to be fetched, or if the file
cannot be interpreted as a valid `<model>` asset.

* `environmentMapReady`: Resolved when a model's selected environment map has been loaded and is
ready to contribute to the visual appearance of the model. The Promise is rejected if there has
been an issue with the model's selected environment map that will prevent its ability to act as
the lighting environment.

## DOM Events

While the author may prevent any built-in interactive behavior for a `<model>` by ommitting the `stagemode`
Expand All @@ -254,15 +267,6 @@ method when handling the `pointerdown` event. If this method is not called for t

The `mousedown` and `touchstart` compatibility events may also be used for this purpose.

* `load`: Dispatched when the model's source file has been loaded and processed, such that the
bounding box information is available and the animation duration, if present, is known.
* `error`: Dispatched if the the model's source file is unable to be fetched, or if the file
cannot be interpreted as a valid `<model>` asset.
* `iblload`: Dispatched when a model's selected environmentmap has been loaded and is ready to
contribute to the visual appearance of the model.
* `iblerror`: Dispatched if there has been an issue with the model's selected environmentmap,
which will prevent its ability to act as the lighting environment.

### DOM actions

In addition to being a standard DOM element, special behaviors may be desirable on spatial platforms,
Expand Down
Loading