react-native-navigation的迁移库

EventEmitter.java 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package com.reactnativenavigation.bridge;
  2. import com.facebook.react.bridge.WritableMap;
  3. import com.reactnativenavigation.NavigationApplication;
  4. import com.reactnativenavigation.react.ReactGateway;
  5. public class EventEmitter {
  6. private ReactGateway reactGateway;
  7. public EventEmitter(ReactGateway reactGateway) {
  8. this.reactGateway = reactGateway;
  9. }
  10. public void sendNavigatorEvent(String eventId, String navigatorEventId) {
  11. if (!NavigationApplication.instance.isReactContextInitialized()) {
  12. return;
  13. }
  14. reactGateway.getReactEventEmitter().sendNavigatorEvent(eventId, navigatorEventId);
  15. }
  16. public void sendNavigatorEvent(String eventId, String navigatorEventId, WritableMap data) {
  17. if (!NavigationApplication.instance.isReactContextInitialized()) {
  18. return;
  19. }
  20. reactGateway.getReactEventEmitter().sendNavigatorEvent(eventId, navigatorEventId, data);
  21. }
  22. public void sendEvent(String eventId, String navigatorEventId) {
  23. if (!NavigationApplication.instance.isReactContextInitialized()) {
  24. return;
  25. }
  26. reactGateway.getReactEventEmitter().sendEvent(eventId, navigatorEventId);
  27. }
  28. public void sendNavigatorEvent(String eventId, WritableMap arguments) {
  29. if (!NavigationApplication.instance.isReactContextInitialized()) {
  30. return;
  31. }
  32. reactGateway.getReactEventEmitter().sendEvent(eventId, arguments);
  33. }
  34. }