Package event

Class EventNode<T extends EventData>

java.lang.Object
event.EventNode<T>
Type Parameters:
T - Type of Event Data this event is for

public class EventNode<T extends EventData> extends Object
A class which can handle Event listeners. Automatically calls all listeners when event occurs
  • Constructor Details

    • EventNode

      public EventNode()
      A default constructor
  • Method Details

    • subscribe

      public void subscribe(EventListener<T> listener)
      Add a function to the listeners list. The function will be called when the event occurs
      Parameters:
      listener - The function that is to be called when the event occurs
    • onEvent

      public void onEvent(T t)
      Notifies the node that an event has occurred. Notifies all listeners
      Parameters:
      t - the data that is to be given to all the listeners.