[]
        
(Showing Draft Content)

EventBus

Class: 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".

Examples

// Liisten frame index changes:
viewer.eventBus.on("frame-index-changed", function(args) { console.log("Image frame changed", args); });
// Listen "after-open" event once:
viewer.eventBus.on("after-open", function(args) { console.log("Image opened", args); }, { once: true });

Implements

Constructors

Constructor

new EventBus(): EventBus;

Class constructor.

Returns

EventBus

Methods

dispatch()

dispatch(eventName, data): void;

Use the dispatch method to raise an event.

Parameters

eventName

EventBusEventName

data

any

Returns

void

Implementation of

IEventBus.dispatch


off()

off(eventName, listener): void;

Remove event listener specified by the listener argument for the event specified by the eventName argument.

Parameters

eventName

EventBusEventName

listener

any

Returns

void

Implementation of

IEventBus.off


offAll()

offAll(eventName): void;

Remove all event listeners for the event specified by the eventName argument.

Parameters

eventName

EventBusEventName

Returns

void


on()

on(
   eventName, 
   listener, 
   options?): void;

Listen eventbus event.

Parameters

eventName

EventBusEventName

listener

any

options?

EventBusAttachOptions

Returns

void

Implementation of

IEventBus.on