Class Crocodoc.EventTarget


Defined in: <ecm\widget\viewer\crocodoc\viewer.js>.

Constructor Summary

Constructor Attributes Constructor Name and Description
 
An object that is capable of generating custom events and also executing handlers for events when they occur.

Method Summary

Method Attributes Method Name and Description
 
fire(type, data)
Fires an event with the given name and data.
 
off(type, handler)
Removes an event handler from a given event.
 
on(type, handler)
Adds a new event handler for a particular type of event.
 
one(type, handler)
Adds a new event handler that should be removed after it's been triggered once.

Constructor Detail

Crocodoc.EventTarget()

An object that is capable of generating custom events and also executing handlers for events when they occur.

Method Detail

{Object} fire(type, data)

Fires an event with the given name and data.
Parameters:
{string} type
The type of event to fire.
{Object} data
An object with properties that should end up on the event object for the given event.
Returns:
{Object} The event object

{void} off(type, handler)

Removes an event handler from a given event. If the handler is not provided, remove all handlers of the given type.
Parameters:
{string} type
The name of the event to remove from.
{Function} handler
The function to remove as a handler.
Returns:
{void}

{void} on(type, handler)

Adds a new event handler for a particular type of event.
Parameters:
{string} type
The name of the event to listen for.
{Function} handler
The function to call when the event occurs.
Returns:
{void}

{void} one(type, handler)

Adds a new event handler that should be removed after it's been triggered once.
Parameters:
{string} type
The name of the event to listen for.
{Function} handler
The function to call when the event occurs.
Returns:
{void}