mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Dispatch events even when there are no listeners
Summary: ## Rationale For every 1 call to RCTNetworking.sendRequest, we execute 6 calls to RCTNetworking.addListener. This is followed by at least one call to RCTNetworking.removeListeners. Aside from incrementing and decrementing the `_listeners` integer, these two methods accomplish nothing else: RCTNetworking doesn't implement the `startObserving` and `stopObserving` methods. This diff makes RCTEventEmitter dispatch events without looking at the listeners integer. In the future, this will allow us to stop making these ~8 unnecessary NativeModule calls for every Network request we send. Changelog: [Internal] Reviewed By: fkgozali Differential Revision: D24272560 fbshipit-source-id: 7996eba5abfa4669a89c43a3ffa536c0faa214a8
This commit is contained in:
committed by
Facebook GitHub Bot
parent
fb14fd42b3
commit
82187bfb6b
@@ -159,7 +159,7 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
- (instancetype)initWithHandlersProvider:(NSArray<id<RCTURLRequestHandler>> * (^)(void))getHandlers
|
||||
{
|
||||
if (self = [super init]) {
|
||||
if (self = [super initWithDisabledObservation]) {
|
||||
_handlersProvider = getHandlers;
|
||||
}
|
||||
return self;
|
||||
|
||||
Reference in New Issue
Block a user