Version: 4.1.0
Component
A class used to manage events in a component
#
Properties#
VERSIONVersion info string
Type: string
Component.VERSION; // ex) 3.0.0
#
Methods#
triggerTrigger a custom event.
Returns: this
- An instance of the component itself
PARAMETER | TYPE | OPTIONAL | DEFAULT | DESCRIPTION |
---|---|---|---|---|
event | string | ComponentEvent | no | The name of the custom event to be triggered or an instance of the ComponentEvent | |
params | Array<any> | $ts:... | no | Event data to be sent when triggering a custom event |
#
onceExecuted event just one time.
Returns: this
- An instance of the component itself
PARAMETER | TYPE | OPTIONAL | DEFAULT | DESCRIPTION |
---|---|---|---|---|
eventName | string | $ts:... | no | The name of the event to be attached or an event name - event handler mapped object. | |
handlerToAttach | function | $ts:... | yes | The handler function of the event to be attached |
#
hasOnChecks whether an event has been attached to a component.
Returns: boolean
- Indicates whether the event is attached.
PARAMETER | TYPE | OPTIONAL | DEFAULT | DESCRIPTION |
---|---|---|---|---|
eventName | string | no | The name of the event to be attached |
#
onAttaches an event to a component.
Returns: this
- An instance of a component itself
PARAMETER | TYPE | OPTIONAL | DEFAULT | DESCRIPTION |
---|---|---|---|---|
eventName | string | $ts:... | no | The name of the event to be attached or an event name - event handler mapped object. | |
handlerToAttach | function | $ts:... | yes | The handler function of the event to be attached |
#
offDetaches an event from the component.
If the eventName
is not given this will detach all event handlers attached.
If the handlerToDetach
is not given, this will detach all event handlers for eventName
.
Returns: this
- An instance of a component itself
PARAMETER | TYPE | OPTIONAL | DEFAULT | DESCRIPTION |
---|---|---|---|---|
eventName | string | $ts:... | yes | The name of the event to be detached | |
handlerToDetach | function | $ts:... | yes | The handler function of the event to be detached |