mirror of
https://github.com/zhigang1992/react-native-code-push.git
synced 2026-05-19 19:39:54 +08:00
Fix usage of NativeEventEmitter
This commit is contained in:
@@ -26,6 +26,9 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
#pragma mark - Private constants
|
||||
|
||||
// These constants represent emitted events
|
||||
static NSString *const DownloadProgressEvent = @"CodePushDownloadProgress";
|
||||
|
||||
// These constants represent valid deployment statuses
|
||||
static NSString *const DeploymentFailed = @"DeploymentFailed";
|
||||
static NSString *const DeploymentSucceeded = @"DeploymentSucceeded";
|
||||
@@ -296,7 +299,7 @@ static NSString *bundleResourceSubdirectory = nil;
|
||||
|
||||
- (void)dispatchDownloadProgressEvent {
|
||||
// Notify the script-side about the progress
|
||||
[self sendEventWithName:@"CodePushDownloadProgress"
|
||||
[self sendEventWithName:DownloadProgressEvent
|
||||
body:@{
|
||||
@"totalBytes" : [NSNumber
|
||||
numberWithLongLong:_latestExpectedContentLength],
|
||||
@@ -537,6 +540,10 @@ static NSString *bundleResourceSubdirectory = nil;
|
||||
[preferences synchronize];
|
||||
}
|
||||
|
||||
- (NSArray<NSString *> *)supportedEvents {
|
||||
return @[DownloadProgressEvent];
|
||||
}
|
||||
|
||||
#pragma mark - Application lifecycle event handlers
|
||||
|
||||
// These two handlers will only be registered when there is
|
||||
|
||||
Reference in New Issue
Block a user