[]
Document Solutions Image Viewer - v7.2.0 / EventBus
The image viewer event bus.
Description
Use the event bus to listen and receive certain specific "events". Available events are: "before-open", "after-open", "before-close", "after-close", "zoom-changed", "frame-index-changed", "animation-started", "animation-stopped".
Example
// Liisten frame index changes:
viewer.eventBus.on("frame-index-changed", function(args) { console.log("Image frame changed", args); });
Example
// Listen "after-open" event once:
viewer.eventBus.on("after-open", function(args) { console.log("Image opened", args); }, { once: true });
• new EventBus()
Class constructor.
▸ on(eventName
, listener
, options?
): void
Listen eventbus event.
Name | Type |
---|---|
eventName |
EventBusEventName |
listener |
any |
options? |
EventBusAttachOptions |
void
▸ off(eventName
, listener
): void
Remove event listener specified by the listener argument for the event specified by the eventName argument.
Name | Type |
---|---|
eventName |
EventBusEventName |
listener |
any |
void
▸ offAll(eventName
): void
Remove all event listeners for the event specified by the eventName argument.
Name | Type |
---|---|
eventName |
EventBusEventName |
void
▸ dispatch(eventName
, data
): void
Use the dispatch method to raise an event.
Name | Type |
---|---|
eventName |
EventBusEventName |
data |
any |
void