new EventStd(setup)
Creates a new instance of the EventStd class.
Parameters:
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
setup |
Object | The setup object. Properties
|
- Source:
Throws:
-
- Throws an error if the setup object is not valid.
- Type
- Error
Members
handler
Function with the handler to be executed when the event is triggered.
Properties:
| Type | Description |
|---|---|
| function |
- Source:
listener
Event listener function handling the triggered event.
- Source:
name
String with the event's name.
Properties:
| Type | Description |
|---|---|
| string |
- Source:
target
The object that is wrapping the event. For example: Workflow, Collection, etc.
Properties:
| Type | Description |
|---|---|
| Object |
- Source:
Methods
add(context) → {Object}
Adds an event listener to the specified context and handles event triggering.
Parameters:
| Name | Type | Description |
|---|---|---|
context |
Object | The context object to which the event listener is added. |
- Source:
Throws:
-
- Throws an error if event listener addition fails.
- Type
- Error
Returns:
- The event listener added to the process.
- Type
- Object
(async) populateTarget(target) → {Object}
Populates the target object with data from the database.
Parameters:
| Name | Type | Description |
|---|---|---|
target |
Object | The target object to be populated. |
- Source:
Throws:
-
- Throws an error if target population fails.
- Type
- Error
Returns:
- The populated target object.
- Type
- Object
trigger(target) → {*}
Triggers the event, emitting it to the specified target.
Parameters:
| Name | Type | Description |
|---|---|---|
target |
Object | The target object on which the event is triggered. |
- Source:
Throws:
-
- Throws an error if event triggering fails.
- Type
- Error
Returns:
- Returns the result of the event emission.
- Type
- *