Skip to main content
Skip table of contents

Event Listeners

As there are different kind of events that you might be interested in, the viewer has an event system to listen to them. The event listener is called whenever this event is emitted. The event listener is added with a callback and can be removed with the token that has been received.

In the following example, we register an event listener whenever the scene has been customized.


Event Types

In the table below you can find all available event types, to all of them can be listened to as described in the example above. All of them can be found under the EVENTTYPE enum (example EVENTTYPE.CAMERA.CAMERA_START).

Name

Description

CAMERA.CAMERA_START

emitted when the camera starts to move

CAMERA.CAMERA_MOVE

emitted when the camera moves per frame (be careful, complex logic in here might slow down your application)

CAMERA.CAMERA_END

emitted when the camera movement ends

INTERACTION.DRAG_START

emitted when the dragging starts

INTERACTION.DRAG_MOVE

emitted during dragging (be careful, complex logic in here might slow down your application)

INTERACTION.DRAG_END

emitted when the dragging ends

INTERACTION.HOVER_ON

emitted when an objects is hovered

INTERACTION.HOVER_OFF

emitted when an objects is not hovered anymore

INTERACTION.SELECT_ON

emitted when an objects is selected

INTERACTION.SELECT_OFF

emitted when an objects is not selected anymore

RENDERING.BEAUTY_RENDERING_FINISHED

emitted when the beauty rendering process has been finished (in case you want to take a screenshot)

SCENE.SCENE_BOUNDING_BOX_CHANGE

emitted when the bounding box of the scene has been changed

SESSION.SESSION_CREATED

emitted when a session has been created

SESSION.SESSION_CUSTOMIZED

emitted when a session has been customized

SESSION.SESSION_CLOSED

emitted when a session has been closed

SESSION.SESSION_INITIAL_OUTPUTS_LOADED

emitted when the first outputs of a session have been loaded

SETTINGS.SETTINGS_UPDATE

emitted when the settings have been updated (usually after a session has just been loaded)

TASK.TASK_START

emitted when a task has been started (tasks could be anything, we use these events for anything that has a loading time)

TASK.TASK_PROCESS

emitted when a task has a process update (tasks could be anything, we use these events for anything that has a loading time)

TASK.TASK_END

emitted when a task has ended (tasks could be anything, we use these events for anything that has a loading time)

TASK.TASK_CANCEL

emitted when a task has been closed (tasks could be anything, we use these events for anything that has a loading time)

VIEWER.VIEWER_CREATED

emitted when a viewer has been created

VIEWER.VIEWER_UPDATED

emitted when a viewer has been updated

VIEWER.VIEWER_CLOSED

emitted when a viewer has been closed


Additional CodeSandBoxes

  • Progress Events - Loading Bar
    The events of the TASK group have the special ability to return the progress of the task. Mostly this is used when loading data (like models, textures, etc). Via the specific TASK_TYPE the events can be separated and a loading bar can be displayed for them.

  • Initial Loading Event
    There is a specific event that is emitted when the session is first loaded.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.