Skip to main content
Pentaho Documentation

Event

pentaho.lang.Event

The Event class is the base class of a certain kind of event objects that can be emitted by event sources.

The source of an event is the object that emits it and is given by the event's source property.

The type of an event is given by its type property.

Event Cancellation

Certain types of events are used to signal that an action is about to execute (or that a phase of an already executing action is about to start). When the execution of the action can be canceled by the event listeners, the event is said to be cancelable. That characteristic is exposed by the isCancelable property.

When an event is canceled, the listeners of unprocessed registrations are not notified.

To cancel an event, call its cancel method. To find out if an event has been canceled, read the isCanceled property.

Persistable Events

Certain types of events are emitted so frequently that it makes it highly beneficial to reuse event objects. To safely use an event object beyond its emission, a cloned event object must be obtained, through clone.

AMD Module

require(["pentaho/lang/Event"], function(Event) { /* code goes here */ });

Constructor

Name Description
new Event(type, source, cancelable)

Creates an event of a given type, source, and ability to be canceled.

Members

Name Description
cancelReason : Error

Gets the reason why the event was canceled, if any, or null.

isCancelable : boolean

Gets a value that indicates if the event can be canceled.

isCanceled : boolean

Gets a value that indicates if the event has been canceled.

source : pentaho.lang.IEventSource

Gets the source of the event.

type : nonEmptyString

Gets the type of the event.

Methods

Name Description
cancel(reason)

Cancels the event.

clone() : pentaho.lang.Event

Creates a clone of the event object.

Constructor Details

new Event(type, source, cancelable)

Creates an event of a given type, source, and ability to be canceled.

Source: javascript/web/pentaho/lang/Event.js, line 27

Parameters:
Name Default Value Summary
type : nonEmptyString

The type of the event.

source : pentaho.lang.IEventSource

The object where the event is emitted.

cancelable : boolean
 
Optional
false

Indicates if the event can be canceled.

Members Details

cancelReason: Error

Gets the reason why the event was canceled, if any, or null.

Source: javascript/web/pentaho/lang/Event.js, line 116

isCancelable: boolean

Gets a value that indicates if the event can be canceled.

Source: javascript/web/pentaho/lang/Event.js, line 106

isCanceled: boolean

Gets a value that indicates if the event has been canceled.

Source: javascript/web/pentaho/lang/Event.js, line 152

source: pentaho.lang.IEventSource

Gets the source of the event.

Source: javascript/web/pentaho/lang/Event.js, line 96

type: nonEmptyString

Gets the type of the event.

Source: javascript/web/pentaho/lang/Event.js, line 86

Methods Details

cancel(reason)

Cancels the event.

This method has no effect if the event is not cancelable or has already been canceled.

Source: javascript/web/pentaho/lang/Event.js, line 131

Parameters:
Name Default Value Summary
reason : string | Error
 
Optional
"canceled"

The reason why the event is being canceled.

See also:  pentaho.lang.Event#isCancelable , pentaho.lang.Event#isCanceled , pentaho.lang.Event#cancelReason

clone() : pentaho.lang.Event

Creates a clone of the event object.

Source: javascript/web/pentaho/lang/Event.js, line 161

Returns:
Name Description
pentaho.lang.Event

The cloned event object.