Target
pentaho.type.action.impl. Target
The Target
class is a mixin class that builds upon EventSource
to implement the ITarget
interface.
It provides a generic action Execution
implementation which delegates to the event observers of each of the execution phases.
The event observers have the following signature:
function(event, action) {
// assert event instanceof pentaho.type.action.Execution;
// assert action === event.action;
// assert action instanceof pentaho.type.action.Base;
// assert this === event.target;
// assert this instanceof pentaho.type.action.ITarget;
}
The do
phase event observer can return a Promise
.
AMD Module
require(["pentaho/type/action/impl/Target"], function(Target) { /* code goes here */ });
Extends
Implements
Constructor
Name | Description |
---|---|
new Target() Abstract | This class was not designed to be constructed directly. It was designed to be used as a mixin. |
Classes
Name | Summary |
---|---|
GenericActionExecution | The |
Methods
Name | Description |
---|---|
_createActionExecution(action) : pentaho.type.action.Execution Protected | Creates an action execution for a given action. |
_createGenericActionExecution(action) : pentaho.type.action.Execution Protected | Creates a generic action execution for a given action. |
_emit(event) : pentaho.lang.Event Protected | Emits an unstructured event and returns it, unless it was canceled. |
_emitActionPhaseDoEvent(actionExecution) : Promise Protected | Emits the |
_emitActionPhaseFinallyEvent(actionExecution) Protected | Emits the |
_emitActionPhaseInitEvent(actionExecution) Protected | Emits the |
_emitActionPhaseWillEvent(actionExecution) Protected | Emits the |
_emitGeneric(source, eventArgs, type, phase, keyArgs) : boolean Protected | Emits an event given an arbitrary payload object, its type and phase. Returns the event payload object, unless the event is canceled. |
_emitGenericAllAsync(source, eventArgs, type, phase, keyArgs) : Promise.< Protected | Emits an event asynchronously, given an arbitrary payload object, its type and phase, and succeeding if every listener succeeds. |
_emitSafe(event) : pentaho.lang.Event Protected | Variation of the |
_hasListeners(type, phase) : boolean Protected | Determines if there are any registrations for a given event type and, optionally, phase. |
act(action) : pentaho.type.action.Execution | Executes or starts execution of a given action in this target and returns the corresponding action execution instance. |
off(typeOrHandle, observer) | Removes one registration given its handle, or all registrations of a given event type (or types) and observer (or listener function). |
on(type, observer, keyArgs) : pentaho.lang.IEventRegistrationHandle | Registers an observer (or listener function) for an event(s) of a given type(s). |
Constructor Details
new Target() Abstract |
---|
This class was not designed to be constructed directly. It was designed to be used as a mixin. Source: javascript/web/pentaho/type/action/impl/Target.js, line 89 |
Methods Details
_createActionExecution(action) : pentaho.type.action.Execution Protected | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Creates an action execution for a given action. The default implementation delegates to [_createGenericActionExecution]{pentaho.type.action.impl.Target#_createGenericActionExecution}. Source: javascript/web/pentaho/type/action/impl/Target.js, line 156
See also: pentaho.type.action.ITarget#act |
_createGenericActionExecution(action) : pentaho.type.action.Execution Protected | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Creates a generic action execution for a given action. The implementation returns an instance of Source: javascript/web/pentaho/type/action/impl/Target.js, line 172
|
_emit(event) : pentaho.lang.Event Protected | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Emits an unstructured event and returns it, unless it was canceled. When this method is called, the listeners of existing registrations are notified synchronously, by priority order and then registration order, until either the event is canceled or all of the listeners have been notified. It is safe to register or unregister to/from an event type while it is being emitted. However, changes are only taken into account in subsequent emissions. If a listener function throws an error, the event processing is interrupted. No more registrations are processed and the error is passed to the caller. Source: javascript/web/pentaho/lang/EventSource.js, line 269 Inherited From: pentaho.lang.EventSource#_emit
See also: pentaho.lang.EventSource#_emitSafe , pentaho.lang.EventSource#_emitGeneric |
_emitActionPhaseDoEvent(actionExecution) : Promise Protected | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Emits the The default implementation delegates to Source: javascript/web/pentaho/type/action/impl/Target.js, line 230
|
_emitActionPhaseFinallyEvent(actionExecution) Protected | ||||||
---|---|---|---|---|---|---|
Emits the The default implementation delegates to Source: javascript/web/pentaho/type/action/impl/Target.js, line 254
|
_emitActionPhaseInitEvent(actionExecution) Protected | ||||||
---|---|---|---|---|---|---|
Emits the The default implementation delegates to Source: javascript/web/pentaho/type/action/impl/Target.js, line 188
|
_emitActionPhaseWillEvent(actionExecution) Protected | ||||||
---|---|---|---|---|---|---|
Emits the The default implementation delegates to Source: javascript/web/pentaho/type/action/impl/Target.js, line 206
|
_emitGeneric(source, eventArgs, type, phase, keyArgs) : boolean Protected | ||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Emits an event given an arbitrary payload object, its type and phase. Returns the event payload object, unless the event is canceled. Source: javascript/web/pentaho/lang/EventSource.js, line 325 Inherited From: pentaho.lang.EventSource#_emitGeneric
|
_emitGenericAllAsync(source, eventArgs, type, phase, keyArgs) : Promise.< Protected | ||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Emits an event asynchronously, given an arbitrary payload object, its type and phase, and succeeding if every listener succeeds. Listeners are called in parallel. Returns a promise that is fulfilled or rejected with the event payload object. If any listener throws or rejects, the returned promise is rejected as well. Source: javascript/web/pentaho/lang/EventSource.js, line 454 Inherited From: pentaho.lang.EventSource#_emitGenericAllAsync
|
_emitSafe(event) : pentaho.lang.Event Protected | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Variation of the If an event listener throws an error, the following event listeners are still processed. Source: javascript/web/pentaho/lang/EventSource.js, line 291 Inherited From: pentaho.lang.EventSource#_emitSafe
See also: pentaho.lang.EventSource#_emit , pentaho.lang.EventSource#_emitGeneric |
_hasListeners(type, phase) : boolean Protected | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Determines if there are any registrations for a given event type and, optionally, phase. This method can be used to avoid creating expensive event objects for an event type and, optionally, phase, that don't have registrations. Source: javascript/web/pentaho/lang/EventSource.js, line 218 Inherited From: pentaho.lang.EventSource#_hasListeners
Examples if(this._hasListeners("click")) { var event = new Event("click", this, true); if(this._emit(event)) { // ... } } if(this._hasListeners("select")) { var event = new Event("select"); if(this._emitGeneric(this, [event], "select", "will")) { // Select ... this._emitGeneric(this, [event], "select", "finally"); } } |
act(action) : pentaho.type.action.Execution | ||
---|---|---|
Executes or starts execution of a given action in this target and returns the corresponding action execution instance. This method can be given |
Name | Default Value | Summary |
---|---|---|
action : pentaho.type.action.Base | pentaho.type.action.spec.IBase | The action or action specification to execute. |
Name | Description |
---|---|
pentaho.type.action.Execution | The resulting action execution. |
off(typeOrHandle, observer) | ||
---|---|---|
Removes one registration given its handle, or all registrations of a given event type (or types) and observer (or listener function). To remove an event registration, it is sufficient to call the It is safe to unregister from an event type while it is being emitted. However, any registrations removed during the current emission will still execute. Specifying an event registration handle that has already been disposed of has no effect. Specifying an event type and observer (or listener function) that have no registrations has no effect. Source: doc-js/pentaho/lang/IEventSource.jsdoc, line 131 Inherited From: pentaho.lang.EventSource#off |
Name | Default Value | Summary |
---|---|---|
typeOrHandle : nonEmptyString | Array.< | pentaho.lang.IEventRegistrationHandle | The type or types of events, or an event registration handle to dispose of. When a string, it can be a comma-separated list of event types. | |
observer : pentaho.lang.IEventObserver | pentaho.lang.EventListener | pentaho.lang.EventListenerAsync | The event observer (or listener function). Required when |
See also: pentaho.lang.IEventSource#on
on(type, observer, keyArgs) : pentaho.lang.IEventRegistrationHandle | ||||||||
---|---|---|---|---|---|---|---|---|
Registers an observer (or listener function) for an event(s) of a given type(s). Optionally, a listening priority may be specified to adjust the order by which an observer is notified, relative to other listeners. Note that if an observer is registered more than once to the same event type, a new registration is created each time and its listeners will be called once per registration. It is safe to register for an event type while it is being emitted. However, new registrations are only taken into account in subsequent emissions. When This method is compatible with the dojo/on API. Source: doc-js/pentaho/lang/IEventSource.jsdoc, line 90 Inherited From: pentaho.lang.EventSource#on |
Name | Default Value | Summary | ||||||
---|---|---|---|---|---|---|---|---|
type : nonEmptyString | Array.< | The type or types of events. When a string, it can be a comma-separated list of event types. | |||||||
observer : pentaho.lang.IEventObserver | pentaho.lang.EventListener | pentaho.lang.EventListenerAsync | The event observer (or listener function). | |||||||
keyArgs : object Optional | Keyword arguments.
|
Name | Description |
---|---|
pentaho.lang.IEventRegistrationHandle | An event registration handle that can be used for later removal. |
See also: pentaho.lang.IEventSource#off