Adds a reference to the counter. If the reference was not yet accounted for, increases the counter by one and emits
a "count-changed" event. Does nothing if the reference was already previously added.
Adds an event listener for a specific event.
The type of the event key.
The event to listen to.
The callback function to be invoked when the event is emitted.
An EventHandle with a remove method to unsubscribe the listener.
Returns the current amount of references.
Removes a reference from the counter. Does nothing if the reference was not accounted for, otherwise decreases the
counter by one and emits a "count-changed" event.
Simple event emitter class that allows adding event listeners and emitting events. Events can be emitted by accessing the protected
emitterfield.