Skip to main content

Home > @jsplumbtoolkit/browser-ui > EventGenerator

EventGenerator class

Base class for classes that wish to support binding and firing of events.


export declare abstract class EventGenerator 


You need to implement the shouldFireEvent method in your concrete subclasses of this class, or you can instead extend from OptimisticEventGenerator, which has a default implementation of shouldFireEvent that returns true.


(constructor)()Constructs a new instance of the EventGenerator class


bind(event, listener, insertAtStart)Bind an event listener. This method can be used with a type parameter by call sites; although it's not necessary it can be helpful to use this to ensure you've thought about what the payload to your event handler is going to be.
fire(event, value, originalEvent)Fire the named event.
getListener(forEvent)Gets all listeners for the given named event.
isSuspendEvents()Returns whether not event firing is currently suspended
setSuspendEvents(val)Sets whether not event firing is currently suspended
shouldFireEvent(event, value, originalEvent)
silently(fn)Run the given function without firing any events.
unbind(eventOrListener, listener)Unbind the given event listener, or all listeners. If you call this method with no arguments then all event listeners are unbound.