Class HasEventHandling

java.lang.Object
io.deephaven.web.client.api.event.HasEventHandling
Direct Known Subclasses:
AbstractTableSubscription, CoreClient, HasLifecycle, IdeSession, JsChart, JsWidget, QueryConnectable, ResponseStreamWrapper

@TsInterface @TsName(namespace="dh") public class HasEventHandling extends Object
Base class providing an event listener API for Deephaven JS client objects.
  • Field Details

    • INTERNAL_EVENT_RELEASED

      public static final String INTERNAL_EVENT_RELEASED
      Internal event name used by some implementations to indicate that the underlying object has been released.
      See Also:
  • Constructor Details

    • HasEventHandling

      public HasEventHandling()
  • Method Details

    • logPrefix

      protected String logPrefix()
    • addEventListener

      @JsMethod public <T> RemoverFn addEventListener(String name, EventFn<T> callback)
      Listen for events on this object.
      Type Parameters:
      T - The type of the data that the event will provide.
      Parameters:
      name - The name of the event to listen for.
      callback - A function to call when the event occurs.
      Returns:
      Returns a cleanup function.
    • addEventListenerOneShot

      public <T> void addEventListenerOneShot(String name, EventFn<T> callback)
    • addEventListenerOneShot

      public void addEventListenerOneShot(HasEventHandling.EventPair<?>... pairs)
    • nextEvent

      @JsMethod public <T> elemental2.promise.Promise<Event<T>> nextEvent(String eventName, @JsOptional @JsNullable Double timeoutInMillis)
      Returns a promise that resolves the next time the named event occurs, with the value of the event's detail. If a timeout is specified and occurs before the event takes place, the promise will reject, otherwise waits indefinitely.
      Type Parameters:
      T - The type of the event detail.
      Parameters:
      eventName - The event name.
      timeoutInMillis - Optional timeout in milliseconds.
      Returns:
      A promise that resolves with the next matching event.
    • hasListeners

      @JsMethod public boolean hasListeners(String name)
      Checks whether any event listeners are registered for the given event name.
      Parameters:
      name - The event name.
      Returns:
      true if there is at least one listener registered for name; false otherwise.
    • hasListener

      public boolean hasListener(String name, EventFn<?> fn)
      Checks whether a specific event listener is registered for the given event name.
      Parameters:
      name - The event name.
      fn - The event listener function.
      Returns:
      True if fn is currently registered for name.
    • removeEventListener

      @JsMethod public <T> boolean removeEventListener(String name, EventFn<T> callback)
      Removes an event listener added to this table.
      Type Parameters:
      T -
      Parameters:
      name -
      callback -
      Returns:
    • fireEvent

      public void fireEvent(String type)
      Fires an event with no detail.
      Parameters:
      type - The event name.
    • fireEvent

      public <T> void fireEvent(String type, T detail)
      Fires an event with the given detail payload.
      Parameters:
      type - The event name.
      detail - The event detail.
    • fireEvent

      public <T> void fireEvent(Event<T> e)
      Fires an event instance.
      Parameters:
      e - The event to fire.
    • fireCriticalEvent

      public <T> void fireCriticalEvent(String type)
      Fires a critical event with no detail.

      If no listeners are registered, a message is logged to the console.

      Parameters:
      type - The event type.
    • fireCriticalEvent

      public <T> void fireCriticalEvent(String type, T detail)
      Fires a critical event with the given detail.

      If no listeners are registered, a message is logged to the console.

      Parameters:
      type - The event type.
      detail - The event detail.
    • failureHandled

      public void failureHandled(String failure)
    • suppressEvents

      public void suppressEvents()
      Suppresses delivery of fired events to listeners.
    • unsuppressEvents

      public void unsuppressEvents()
      Re-enables delivery of fired events to listeners.
    • isSuppress

      public boolean isSuppress()
      Checks whether events are currently suppressed.
      Returns:
      True if events are suppressed.