Add `RCTJavaScriptWillStartExecutingNotification`
Summary: `RCTJavaScriptWillStartLoadingNotification` is being posted when starting the bridge, not when starting to execute JS code. Here, we add `RCTJavaScriptWillStartExecutingNotification`, and in post it before executing JS with `RCTCxxBridge`. Reviewed By: fromcelticpark Differential Revision: D7153659 fbshipit-source-id: 902075308d54a47bef43b6f57edf2e624f621ceb
This commit is contained in:
parent
b7bb2e5745
commit
48c339ddc7
|
@ -19,10 +19,16 @@
|
||||||
@class RCTPerformanceLogger;
|
@class RCTPerformanceLogger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This notification fires when the bridge starts loading the JS bundle.
|
* This notification fires when the bridge initializes.
|
||||||
*/
|
*/
|
||||||
RCT_EXTERN NSString *const RCTJavaScriptWillStartLoadingNotification;
|
RCT_EXTERN NSString *const RCTJavaScriptWillStartLoadingNotification;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This notification fires when the bridge starts executing the JS bundle.
|
||||||
|
*/
|
||||||
|
RCT_EXTERN NSString *const RCTJavaScriptWillStartExecutingNotification;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This notification fires when the bridge has finished loading the JS bundle.
|
* This notification fires when the bridge has finished loading the JS bundle.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#import "RCTUtils.h"
|
#import "RCTUtils.h"
|
||||||
|
|
||||||
NSString *const RCTJavaScriptWillStartLoadingNotification = @"RCTJavaScriptWillStartLoadingNotification";
|
NSString *const RCTJavaScriptWillStartLoadingNotification = @"RCTJavaScriptWillStartLoadingNotification";
|
||||||
|
NSString *const RCTJavaScriptWillStartExecutingNotification = @"RCTJavaScriptWillStartExecutingNotification";
|
||||||
NSString *const RCTJavaScriptDidLoadNotification = @"RCTJavaScriptDidLoadNotification";
|
NSString *const RCTJavaScriptDidLoadNotification = @"RCTJavaScriptDidLoadNotification";
|
||||||
NSString *const RCTJavaScriptDidFailToLoadNotification = @"RCTJavaScriptDidFailToLoadNotification";
|
NSString *const RCTJavaScriptDidFailToLoadNotification = @"RCTJavaScriptDidFailToLoadNotification";
|
||||||
NSString *const RCTDidInitializeModuleNotification = @"RCTDidInitializeModuleNotification";
|
NSString *const RCTDidInitializeModuleNotification = @"RCTDidInitializeModuleNotification";
|
||||||
|
|
|
@ -1162,6 +1162,9 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
|
||||||
{
|
{
|
||||||
[self _tryAndHandleError:^{
|
[self _tryAndHandleError:^{
|
||||||
NSString *sourceUrlStr = deriveSourceURL(url);
|
NSString *sourceUrlStr = deriveSourceURL(url);
|
||||||
|
[[NSNotificationCenter defaultCenter]
|
||||||
|
postNotificationName:RCTJavaScriptWillStartExecutingNotification
|
||||||
|
object:self->_parentBridge userInfo:@{@"bridge": self}];
|
||||||
if (isRAMBundle(script)) {
|
if (isRAMBundle(script)) {
|
||||||
[self->_performanceLogger markStartForTag:RCTPLRAMBundleLoad];
|
[self->_performanceLogger markStartForTag:RCTPLRAMBundleLoad];
|
||||||
auto ramBundle = std::make_unique<JSIndexedRAMBundle>(sourceUrlStr.UTF8String);
|
auto ramBundle = std::make_unique<JSIndexedRAMBundle>(sourceUrlStr.UTF8String);
|
||||||
|
|
Loading…
Reference in New Issue