0.2.0 • Published 5 years ago
@hamgom95/eventemitter v0.2.0
@hamgom95/eventemitter
Simple EventEmitter implementation.
API Documentation
EventEmitter
Event emitter.
Kind: global class
Properties
Name | Type | Description |
---|---|---|
events | Map | Event listener map |
eventEmitter.on(event, listener, opts)
Register event listener
Kind: instance method of EventEmitter
Param | Type | Description |
---|---|---|
event | string | Event name |
listener | function | Listener callback |
opts | Object | Options |
opts.prepend | boolean | Whether to prepend listener |
opts.once | boolean | Whether to use listener once only |
eventEmitter.off(event, listener)
Unregister listener.
Kind: instance method of EventEmitter
Param | Type | Description |
---|---|---|
event | string | Event name. |
listener | function | Same function that was registered. |
eventEmitter.emit(event, ...args)
Emit event with arguments.
Kind: instance method of EventEmitter
Param | Type | Description |
---|---|---|
event | string | Event name. |
...args | any | Arguments to pass to listeners. |
0.2.0
5 years ago