Class EventBus


  • public class EventBus
    extends Object
    简单事件总线.
    Author:
    zhangjianshe
    • Constructor Detail

      • EventBus

        public EventBus()
        Instantiates a new event bus.
    • Method Detail

      • register

        public boolean register​(String topic,
                                IEventHandler handler)
        向消息总线注册消息句柄.
        Parameters:
        topic - the topic
        handler - the handler
        Returns:
        true, if successful
      • unregister

        public boolean unregister​(String topic,
                                  IEventHandler handler)
        向事件总线移除消息处理句柄.
        Parameters:
        topic - the topic
        handler - the handler
        Returns:
        true, if successful
      • fire

        public void fire​(String topic,
                         int type,
                         Object event)
        激发一个事件.
        Parameters:
        topic - the topic
        type - the type
        event - the event