Event callbacks event-callbacks

The viewer supports JavaScript event callbacks that the web page uses to track the viewer initialization process or runtime behavior.

Callback handlers are assigned by passing event names and corresponding handler functions with the handlers property to config JSON object in the viewer’s constructor. Alternatively, it is possible to use setHandlers() API method.

Supported viewer events include the following:

Viewer event
Description
initComplete
Triggers when viewer initialization is complete and all internal components are created, so that it is possible to use getComponent() API. The callback handler does not take any arguments.
trackEvent

Triggers each time an event occurs inside the viewer which may be handled by an event tracking system, such as Adobe Analytics. The callback handler accepts the following arguments:

  • objID {String} - not currently used.

  • compClass {String} - not currently used.

  • instName {String} - an instance name of the Viewer SDK component that triggered the event.

  • timeStamp {Number} - event time stamp.

  • eventInfo {String} - event payload.

quickViewActivate

Triggers when the user activates a hotspot with Quickview data associated with it. The callback handler takes the following argument:

  • data {Object} - a JSON object containing data from the hotspot definition. The field sku is mandatory while other fields are optional and depend on the source hotspot definition.

See also InteractiveImage and setHandlers.

recommendation-more-help
b7426f53-aad9-4c00-83fc-664f30f681e8