-
Notifications
You must be signed in to change notification settings - Fork 0
Description
This can help developers who use Eventus find memory leaks in their code.
emitter.setMaxListeners(n)
By default EventEmitters will print a warning if more than 10 listeners are added for a particular event. This is a useful default which helps finding memory leaks. Obviously not all Emitters should be limited to 10. This function allows that to be increased. Set to zero for unlimited.
emitter.getMaxListeners()
Returns the current max listener value for the emitter which is either set by emitter.setMaxListeners(n) or defaults to EventEmitter.defaultMaxListeners.
This can be useful to increment/decrement max listeners to avoid the warning while not being irresponsible and setting a too big number.
Eventus.defaultMaxListeners
emitter.setMaxListeners(n) sets the maximum on a per-instance basis. This class property lets you set it for all Eventus instances, current and future, effective immediately. Use with care.
Note that emitter.setMaxListeners(n) still has precedence over Eventus.defaultMaxListeners.