react-native-navigation的迁移库

RNNEventEmitter.m 862B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #import "RNNEventEmitter.h"
  2. #import "RNN.h"
  3. @implementation RNNEventEmitter
  4. RCT_EXPORT_MODULE();
  5. static NSString* const onAppLaunched = @"RNN.appLaunched";
  6. static NSString* const containerStart = @"RNN.containerStart";
  7. static NSString* const containerStop = @"RNN.containerStop";
  8. -(NSArray<NSString *> *)supportedEvents
  9. {
  10. return @[onAppLaunched, containerStart, containerStop];
  11. }
  12. # pragma mark public
  13. -(void)sendOnAppLaunched
  14. {
  15. [self send:onAppLaunched body:nil];
  16. }
  17. -(void)sendContainerStart:(NSString *)containerId
  18. {
  19. [self send:containerStart body:containerId];
  20. }
  21. -(void)sendContainerStop:(NSString *)containerId
  22. {
  23. [self send:containerStop body:containerId];
  24. }
  25. # pragma mark private
  26. -(void)send:(NSString *)eventName body:(id)body
  27. {
  28. [[[RNN instance].bridge moduleForClass:[RNNEventEmitter class]] sendEventWithName:eventName body:body];
  29. }
  30. @end