Package net.phoenix

Interface Callback<T extends Event>

Type Parameters:
T - Event
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Callback<T extends Event>
Simple callback
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    call(String channel, T event)
    Can be used in two ways;
  • Method Details

    • call

      void call(String channel, T event)
      Can be used in two ways;
       
       eventEmitter.on("channel", (channel, event) -> {
           // Handle Event
         }
       
       
      OR
       
       public class EventHandler implements Callback<CustomEvent> {
               @Override
               public void call(String channel, CustomEvent event) {
                   // Handle Event
               }
            }
      
            eventEmitter.on("channel, new EventHandler());
       
       
      Parameters:
      channel - Channel that message is incoming from. If it is channel specific, it will be the channel name it was registered under. If it is a global
      event - Instance of event