Events

Christian Schlinkmann edited this page Oct 26, 2015 · 12 revisions

xml3d.js supports following HTML events:

Table of Contents

load

On elements: xml3d, mesh, shader, lightshader, data, dataflow, asset, model

The load event is triggered when all resources connected to the target have been completely loaded.

xml3d
the event is fired when all external resources (mesh data, textures etc.) have been completely loaded
mesh, shader, lightshader, data, dataflow
the event is fired when all generic data (including textures) connected to these nodes has been loaded. If one of these elements includes a complex sub-graph of nested external resources, the event is fired only once all these resources have been loaded.
asset, model
the event is fired once the src-model and all <model> <assetdata> and <assetmesh> children have been completely loaded.
For the xml3d element, the load event fires the first time all external resources finished loading. If an external reference is modified that results in the loading of a (non-cached) external resource, the load event will *not* fire again. For these cases you can attach a load listener directly to the element that initiated the request.

For all other element, the load event will fire again whenever any potentially external reference (such as a src attribute) within the content of the element is modified.

In addition to load events, all these elements provide the complete property which returns false if resources are currently loading for the element and true if everything has been loaded.

unsupported

On elements: xml3d

The unsupported event is fired if the current browser doesn't support XML3D. Calling e.preventDefault() during the event callback skips the generation of a warning within the HTML document.

canplaythrough

On elements: video

See https://developer.mozilla.org/en-US/docs/DOM/Media_events for details. Note: this event can only be added via addEventListener, oncanplaythrough attribute does not work.

ended

On elements: video

See https://developer.mozilla.org/en-US/docs/DOM/Media_events for details. Note: this event can only be added via addEventListener, onended attribute does not work.

framedrawn

On elements: xml3d

The framedrawn event is fired each time a frame has finished drawing. The event.detail field contains statistical information about the frame, such as the number of objects rendered and the time in ms spent rendering the frame.