Fix usage of NativeEventEmitter

This commit is contained in:
Richard Hua
2016-09-23 17:13:51 -07:00
parent d9896a5952
commit 6dc1fb8487
2 changed files with 11 additions and 3 deletions

View File

@@ -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