Class: EventSource

OpenSeadragon.EventSource

For use by classes which want to support custom, non-browser events.

Constructor

new EventSource()

Source:

Methods

addHandler(eventName, handler, userDataopt, priorityopt) → {Boolean}

Add an event handler for a given event.
Parameters:
Name Type Attributes Default Description
eventName String Name of event to register.
handler OpenSeadragon.EventHandler Function to call when event is triggered.
userData Object <optional>
null Arbitrary object to be passed unchanged to the handler.
priority Number <optional>
0 Handler priority. By default, all priorities are 0. Higher number = priority.
Source:
Returns:
- True if the handler was added, false if it was rejected
Type
Boolean

addOnceHandler(eventName, handler, userDataopt, timesopt, priorityopt) → {Boolean}

Add an event handler to be triggered only once (or a given number of times) for a given event. It is not removable with removeHandler().
Parameters:
Name Type Attributes Default Description
eventName String Name of event to register.
handler OpenSeadragon.EventHandler Function to call when event is triggered.
userData Object <optional>
null Arbitrary object to be passed unchanged to the handler.
times Number <optional>
1 The number of times to handle the event before removing it.
priority Number <optional>
0 Handler priority. By default, all priorities are 0. Higher number = priority.
Source:
Returns:
- True if the handler was added, false if it was rejected
Type
Boolean

getHandler(eventName)

Get a function which iterates the list of all handlers registered for a given event, calling the handler for each.
Parameters:
Name Type Description
eventName String Name of event to get handlers for.
Source:

numberOfHandlers(eventName) → {number}

Get the amount of handlers registered for a given event.
Parameters:
Name Type Description
eventName String Name of event to inspect.
Source:
Returns:
amount of events
Type
number

raiseEvent(eventName, eventArgs) → {Boolean}

Trigger an event, optionally passing additional information.
Parameters:
Name Type Description
eventName String Name of event to register.
eventArgs Object Event-specific data.
Source:
Returns:
True if the event was fired, false if it was rejected because of rejectEventHandler(eventName)
Type
Boolean

removeAllHandlers(eventName)

Remove all event handlers for a given event type. If no type is given all event handlers for every event type are removed.
Parameters:
Name Type Description
eventName String Name of event for which all handlers are to be removed.
Source:

removeHandler(eventName, handler)

Remove a specific event handler for a given event.
Parameters:
Name Type Description
eventName String Name of event for which the handler is to be removed.
handler OpenSeadragon.EventHandler Function to be removed.
Source: