Constructor
new EventsHandlers(setupopt)
Creates an instance of EventsHandlers.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
setup |
Object |
<optional> |
The configuration for the instance. Properties
|
Methods
(async) answer(ev) → {*}
Handles the "answer" event and returns the event object.
Parameters:
| Name | Type | Description |
|---|---|---|
ev |
* | The event object. |
Throws:
-
- If an error occurs while handling the event.
- Type
- Error.Log
Returns:
- The event object.
- Type
- *
(async) back(ev) → {*}
Triggers the "back" event and logs a message to the console.
Parameters:
| Name | Type | Description |
|---|---|---|
ev |
* | The event object. |
Throws:
-
- If an error occurs while handling the event.
- Type
- Error.Log
Returns:
- The event object.
- Type
- *
(async) end(ev) → {Promise.<any>}
Handles end event.
Parameters:
| Name | Type | Description |
|---|---|---|
ev |
any | The event object. |
Throws:
-
Throws an error if an error occurred while executing the event handler.
- Type
- Error
Returns:
Promise that resolves to the event object if the event was handled successfully.
- Type
- Promise.<any>
(async) error(ev, err) → {Promise.<any>}
Handles error event.
Parameters:
| Name | Type | Description |
|---|---|---|
ev |
any | The event object. |
err |
Error | The error object. |
Throws:
-
Throws an error if an error occurred while executing the event handler.
- Type
- Error
Returns:
Promise that resolves to the event object if the event was handled successfully.
- Type
- Promise.<any>
(async) next(ev) → {*}
Triggers the "next" event and returns the event object.
Parameters:
| Name | Type | Description |
|---|---|---|
ev |
* | The event object. |
Throws:
-
- If an error occurs while handling the event.
- Type
- Error.Log
Returns:
- The event object.
- Type
- *
(async) repeat(ev) → {*}
Triggers the "repeat" event and logs a message to the console.
Parameters:
| Name | Type | Description |
|---|---|---|
ev |
* | The event object. |
Throws:
-
- If an error occurs while handling the event.
- Type
- Error.Log
Returns:
- The event object.
- Type
- *
(async) start(ev) → {*}
Starts the event and returns the event object.
Parameters:
| Name | Type | Description |
|---|---|---|
ev |
* | The event object. |
Throws:
-
- If an error occurs while handling the event.
- Type
- Error.Log
Returns:
- The event object.
- Type
- *
(async) trigger(ev) → {*}
Triggers the event and returns the event object.
Parameters:
| Name | Type | Description |
|---|---|---|
ev |
* | The event object. |
Throws:
-
- If an error occurs while handling the event.
- Type
- Error.Log
Returns:
- The event object.
- Type
- *
(async) triggerEvent(eventName, …args)
Triggers a specified event with optional parameters.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
eventName |
QuestionModel | The Question event that triggered the event |
|
args |
* |
<repeatable> |
The event name and any optional parameters. |
Throws:
-
- If an error occurs while handling the event.
- Type
- Error.Log