Home > @findkit/ui > Emitter

Emitter class

Simple event emitter

Signature:

export declare class Emitter<Events extends {}, Context> 

Constructors

Constructor Modifiers Description
(constructor)(context) Constructs a new instance of the Emitter class

Methods

Method Modifiers Description
dispose()

Dispose the event emitter by removing all handlers.

Do not call this from ui.events! It will break the UI!

emit(eventName, event) Emit event to the event handlers
off(eventName, handler) Manually unbind an event handler given to .on() or .once()
on(eventName, handler) Bind an event handler to the emitter
once(eventName, handler) Like .on() but will only fire once