Events
on
on(event: string, callback: Function)
Adds a listener function to an event. Parameters passed to the callback will depend on the event. See Events for more information.
api.on('viewer.ready', function() {
console.log('Viewer is ready');
});
once
once(event: string, callback: Function)
Adds a listener function to an event and is removed after one event. Parameters passed to the callback will depend on the event. See Events for more information.
api.once('viewer.ready', function() {
console.log('Viewer is ready');
});
off
off(event: string)
Remove a listener function from an event.
api.off('viewer.ready');
Events
Viewer
viewer.ready
This event is triggered when the viewer is ready.
viewer.start
This event is triggered when the viewer is started.
viewer.stop
This event is triggered when the viewer is stopped.
Mouse
click
This event is triggered when the user clicks or taps in the viewer.
The event listener callback receives a JSON object with the following attributes:
{
"nodeId": 1234,
"targetNodeId": "clickedNodeId"
}
Link
link.open
This event is triggered when the user opens a link from inside the viewer.
The event listener callback receives a JSON object with the following attributes:
{
"link": "https://link.url"
}
Camera
Work in Progress
This events are currently not available in the API, but will be available soon.
camera.start
This event is triggered when the camera begins to move.
camera.stop
This event is triggered when the camera stops moving.
Annotations
Work in Progress
This events are currently not available in the API, but will be available soon.
annotation.select
This event is triggered when an annotation is selected.
The event listener callback receives the index of the selected annotation (a number). Annotation indices are zero-based.
Animations
Work in Progress
This events are currently not available in the API, but will be available soon.
animation.play
This event is triggered when the animation track starts playing.
animation.stop
This event is triggered when the animation track stops.
animation.ended
This event is triggered when the animation track ends.
animation.change
This event is triggered when the animation track changes.
AR
ar.open
This event is triggered when AR screen opens
ar.close
This event is triggered when AR screen closes