mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-29 04:35:36 +08:00
Deprecated RCTDidCreateNativeModules notification
Summary: public Thanks to the new lazy initialization system for modules, `RCTDidCreateNativeModules` no longer does what the name implies. Previously, `RCTDidCreateNativeModules` was fired after all native modules had been initialized. Now, it simply fires each time the bridge is reloaded. Modules are created on demand when they are needed, so most of the assumptions about when `RCTDidCreateNativeModules` will fire are now incorrect. This diff deprecates `RCTDidCreateNativeModules`, and adds a new notification, `RCTDidInitializeModuleNotification`, which fires each time a module a new module is instantiated. If you need to access a module at any time you can just call `-[bridge moduleForClass:]` and the module will be instantiated on demand. If you want to access a module *only* after it has already been instantiated, you can use the `RCTDidInitializeModuleNotification` notification. Reviewed By: tadeuzagallo Differential Revision: D2755036 fb-gh-sync-id: 25bab6d5eb6fcd35d43125ac45908035eea01487
This commit is contained in:
committed by
facebook-github-bot-5
parent
2d61dfd9c1
commit
f7edcda5d7
@@ -403,7 +403,7 @@ void RCTProfileInit(RCTBridge *bridge)
|
||||
forMode:NSRunLoopCommonModes];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:RCTProfileDidStartProfiling
|
||||
object:nil];
|
||||
object:bridge];
|
||||
}
|
||||
|
||||
void RCTProfileEnd(RCTBridge *bridge, void (^callback)(NSString *))
|
||||
@@ -417,7 +417,7 @@ void RCTProfileEnd(RCTBridge *bridge, void (^callback)(NSString *))
|
||||
OSAtomicAnd32Barrier(0, &RCTProfileProfiling);
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:RCTProfileDidEndProfiling
|
||||
object:nil];
|
||||
object:bridge];
|
||||
|
||||
[RCTProfileDisplayLink invalidate];
|
||||
RCTProfileDisplayLink = nil;
|
||||
|
||||
Reference in New Issue
Block a user