void notify(Message message); } // Publishing an Event Watchers.of(PushWatcher.class).notify(message); // Subscribing to an Event public class MyFragment extends Fragment implement PushWatcher { public void notify(Message message) { } public void onStart() { Watchers.bind(this); } } Watcher
void notify(Message message); } // Publishing an Event Watchers.of(PushWatcher.class).notify(message); // Subscribing to an Event public class MyFragment extends Fragment implement PushWatcher { public void notify(Message message) { } public void onStart() { Watchers.bind(this); } } Watcher // Define an Event public interface PushWatcher extents Watchers.Watcher { void notify(Message message); } // Publishing an Event Watchers.of(PushWatcher.class).notify(message); // Subscribing to an Event public class MyFragment extends Fragment implement PushWatcher { public void notify(Message message) { } public void onStart() { Watchers.bind(this); } }
void notify(Message message); } // Publishing an Event Watchers.of(PushWatcher.class).notify(message); // Subscribing to an Event public class MyFragment extends Fragment implement PushWatcher { public void notify(Message message) { } public void onStart() { Watchers.bind(this); } } 类型安全 & 重构
void notify(Message message); } // Publishing an Event Watchers.of(PushWatcher.class).notify(message); // Subscribing to an Event public class MyFragment extends Fragment implement PushWatcher { public void notify(Message message) { } public void onStart() { Watchers.bind(this); } } 类型安全 & 重构 // Define an Event public interface PushWatcher extents Watchers.Watcher { void notify(Message message); } // Publishing an Event Watchers.of(PushWatcher.class).notify(message); // Subscribing to an Event public class MyFragment extends Fragment implement PushWatcher { public void notify(Message message) { } public void onStart() { Watchers.bind(this); } }