Zimlet JavaScript API Reference - ZmEvent

Class ZmEvent


This class represents an event that encapsulates some sort of change to a model (data). The event has a data type (for example, conversation), an event type (for example, delete), a source (the data object generating the event), and a hash of arbitrary information (details).

Defined in: ZmEvent.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
ZmEvent(type)
Creates an empty event of the given type.
Field Summary
Field Attributes Field Name and Description
<static>  
ZmEvent.E_COMPLETE
Defines the "complete" event type.
<static>  
ZmEvent.E_CREATE
Defines the "create" event type.
<static>  
ZmEvent.E_DELETE
Defines the "delete" event type.
<static>  
ZmEvent.E_FLAGS
Defines the "flags" event type.
<static>  
ZmEvent.E_LOAD
Defines the "load" event type.
<static>  
ZmEvent.E_MODIFY
Defines the "modify" event type.
<static>  
ZmEvent.E_MOVE
Defines the "move" event type.
<static>  
ZmEvent.E_REMOVE
Defines the "remove" event type.
<static>  
ZmEvent.E_REMOVE_ALL
Defines the "remove all" event type.
<static>  
ZmEvent.E_TAGS
Defines the "tags" event type.
<static>  
ZmEvent.E_ZIMLETS
Defines the "zimlets" event type.
Method Summary
Method Attributes Method Name and Description
 
getDetail(field)
Gets info from the event details.
 
Gets the event details.
 
Gets items by checking for a detail with a name of "items" and returning it.
 
set(event, source)
Sets the event type and source.
 
setDetail(field, value)
Adds info to the event details.
 
setDetails(details)
Sets the event details.
 
Returns a string representation of the object.
Class Detail
ZmEvent(type)
Creates an empty event of the given type.
Parameters:
{constant} type
the source of the event
Field Detail
<static> ZmEvent.E_COMPLETE
Defines the "complete" event type.

<static> ZmEvent.E_CREATE
Defines the "create" event type.

<static> ZmEvent.E_DELETE
Defines the "delete" event type.

<static> ZmEvent.E_FLAGS
Defines the "flags" event type.

<static> ZmEvent.E_LOAD
Defines the "load" event type.

<static> ZmEvent.E_MODIFY
Defines the "modify" event type.

<static> ZmEvent.E_MOVE
Defines the "move" event type.

<static> ZmEvent.E_REMOVE
Defines the "remove" event type.

<static> ZmEvent.E_REMOVE_ALL
Defines the "remove all" event type.

<static> ZmEvent.E_TAGS
Defines the "tags" event type.

<static> ZmEvent.E_ZIMLETS
Defines the "zimlets" event type.
Method Detail
{Object} getDetail(field)
Gets info from the event details.
Parameters:
{String} field
the detail field name
Returns:
{Object} the details

{Hash} getDetails()
Gets the event details.
Returns:
{Hash} the event details

{Array} getItems()
Gets items by checking for a detail with a name of "items" and returning it.
Returns:
{Array} an array of items or empty array if "items" does not exist

set(event, source)
Sets the event type and source.
Parameters:
{constant} event
the event type (see ZmEvent.E_ constants)
{Object} source
the object that generated the event (typically "this")

setDetail(field, value)
Adds info to the event details.
Parameters:
{String} field
the detail name
{Object} value
the detail value

setDetails(details)
Sets the event details. Any existing details will be lost.
Parameters:
{Hash} details
a hash representing event details

{String} toString()
Returns a string representation of the object.
Returns:
{String} a string representation of the object

Documentation generated by JsDoc Toolkit 2.3.0 on Tue Jun 28 2016 21:01:37 GMT-0400 (EDT)