Simple library to work with custom events.
(require("neva"))( [target])
Create event emitter or add methods to work with events into specified object.
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
target |
Object |
<optional> |
Object that should be enhanced by methods to work with events.
If |
Returns:
Value of target
parameter or new object that is enhanced by methods to work with events.
Type Definitions
-
EventData
-
Data about emitted event.
Type:
- Object
Properties:
Name Type Description type
string The event type (value of
type
parameter passed in EventEmitterMixin.emit method).params
Array List of additional parameters that are passed besides the event type in EventEmitterMixin.emit method.
data
any Value of the first additional parameter that is passed in EventEmitterMixin.emit method (value of
params[0]
). -
EventEmitter
-
An object that has methods to work with events.
Type:
- Object
- Mixes In:
-
HandlerSettings
-
Event handler settings.
Type:
- Object
Properties:
Name Type Argument Default Description once
boolean <optional>
false Whether event handler should be called just once.