[ReactNative] Move module info from bridge to RCTModuleData
Summary:
@public
The info about bridge modules (such as id, name, queue, methods...) was spread
across arrays & dictionaries on the bridge, move it into a specific class.
It also removes a lot of information that was statically cached, and now have
the same lifecycle of the bridge.
Also moved RCTModuleMethod, RCTFrameUpdate and RCTBatchedBridge into it's own
files, for organization sake.
NOTE: This diff seems huge, but most of it was just moving code :)
Test Plan:
Tested UIExplorer & UIExplorer tests, Catalyst, MAdMan and Groups. Everything
looks fine.
2015-06-24 23:34:56 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the BSD-style license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
|
2015-11-25 11:09:00 +00:00
|
|
|
#import "RCTInvalidating.h"
|
[ReactNative] Move module info from bridge to RCTModuleData
Summary:
@public
The info about bridge modules (such as id, name, queue, methods...) was spread
across arrays & dictionaries on the bridge, move it into a specific class.
It also removes a lot of information that was statically cached, and now have
the same lifecycle of the bridge.
Also moved RCTModuleMethod, RCTFrameUpdate and RCTBatchedBridge into it's own
files, for organization sake.
NOTE: This diff seems huge, but most of it was just moving code :)
Test Plan:
Tested UIExplorer & UIExplorer tests, Catalyst, MAdMan and Groups. Everything
looks fine.
2015-06-24 23:34:56 +00:00
|
|
|
|
2015-11-03 22:45:46 +00:00
|
|
|
@protocol RCTBridgeMethod;
|
2015-11-25 11:09:00 +00:00
|
|
|
@protocol RCTBridgeModule;
|
|
|
|
@class RCTBridge;
|
2015-11-03 22:45:46 +00:00
|
|
|
|
2015-11-25 11:09:00 +00:00
|
|
|
@interface RCTModuleData : NSObject <RCTInvalidating>
|
[ReactNative] Move module info from bridge to RCTModuleData
Summary:
@public
The info about bridge modules (such as id, name, queue, methods...) was spread
across arrays & dictionaries on the bridge, move it into a specific class.
It also removes a lot of information that was statically cached, and now have
the same lifecycle of the bridge.
Also moved RCTModuleMethod, RCTFrameUpdate and RCTBatchedBridge into it's own
files, for organization sake.
NOTE: This diff seems huge, but most of it was just moving code :)
Test Plan:
Tested UIExplorer & UIExplorer tests, Catalyst, MAdMan and Groups. Everything
looks fine.
2015-06-24 23:34:56 +00:00
|
|
|
|
2015-11-25 11:09:00 +00:00
|
|
|
- (instancetype)initWithModuleClass:(Class)moduleClass
|
|
|
|
bridge:(RCTBridge *)bridge NS_DESIGNATED_INITIALIZER;
|
|
|
|
|
2016-01-05 17:04:08 +00:00
|
|
|
- (instancetype)initWithModuleInstance:(id<RCTBridgeModule>)instance
|
2016-03-03 10:20:20 +00:00
|
|
|
bridge:(RCTBridge *)bridge NS_DESIGNATED_INITIALIZER;
|
2016-01-07 09:29:43 +00:00
|
|
|
|
2016-02-29 17:47:14 +00:00
|
|
|
/**
|
|
|
|
* Calls `constantsToExport` on the module and stores the result. Note that
|
|
|
|
* this will init the module if it has not already been created. This method
|
|
|
|
* can be called on any thread, but may block the main thread briefly if the
|
|
|
|
* module implements `constantsToExport`.
|
|
|
|
*/
|
|
|
|
- (void)gatherConstants;
|
|
|
|
|
2015-07-27 15:51:28 +00:00
|
|
|
@property (nonatomic, strong, readonly) Class moduleClass;
|
[ReactNative] Move module info from bridge to RCTModuleData
Summary:
@public
The info about bridge modules (such as id, name, queue, methods...) was spread
across arrays & dictionaries on the bridge, move it into a specific class.
It also removes a lot of information that was statically cached, and now have
the same lifecycle of the bridge.
Also moved RCTModuleMethod, RCTFrameUpdate and RCTBatchedBridge into it's own
files, for organization sake.
NOTE: This diff seems huge, but most of it was just moving code :)
Test Plan:
Tested UIExplorer & UIExplorer tests, Catalyst, MAdMan and Groups. Everything
looks fine.
2015-06-24 23:34:56 +00:00
|
|
|
@property (nonatomic, copy, readonly) NSString *name;
|
2015-11-25 11:09:00 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the module methods. Note that this will gather the methods the first
|
|
|
|
* time it is called and then memoize the results.
|
|
|
|
*/
|
2015-11-03 22:45:46 +00:00
|
|
|
@property (nonatomic, copy, readonly) NSArray<id<RCTBridgeMethod>> *methods;
|
[ReactNative] Move module info from bridge to RCTModuleData
Summary:
@public
The info about bridge modules (such as id, name, queue, methods...) was spread
across arrays & dictionaries on the bridge, move it into a specific class.
It also removes a lot of information that was statically cached, and now have
the same lifecycle of the bridge.
Also moved RCTModuleMethod, RCTFrameUpdate and RCTBatchedBridge into it's own
files, for organization sake.
NOTE: This diff seems huge, but most of it was just moving code :)
Test Plan:
Tested UIExplorer & UIExplorer tests, Catalyst, MAdMan and Groups. Everything
looks fine.
2015-06-24 23:34:56 +00:00
|
|
|
|
2015-11-25 11:09:00 +00:00
|
|
|
/**
|
|
|
|
* Returns YES if module instance has already been initialized; NO otherwise.
|
|
|
|
*/
|
|
|
|
@property (nonatomic, assign, readonly) BOOL hasInstance;
|
|
|
|
|
2016-03-03 10:20:20 +00:00
|
|
|
/**
|
|
|
|
* Returns YES if module instance must be created on the main thread.
|
|
|
|
*/
|
2016-06-06 14:57:55 +00:00
|
|
|
@property (nonatomic, assign, readonly) BOOL requiresMainQueueSetup;
|
2016-03-03 10:20:20 +00:00
|
|
|
|
2016-03-07 17:30:20 +00:00
|
|
|
/**
|
|
|
|
* Returns YES if module has constants to export.
|
|
|
|
*/
|
|
|
|
@property (nonatomic, assign, readonly) BOOL hasConstantsToExport;
|
|
|
|
|
2015-11-25 11:09:00 +00:00
|
|
|
/**
|
|
|
|
* Returns the current module instance. Note that this will init the instance
|
|
|
|
* if it has not already been created. To check if the module instance exists
|
|
|
|
* without causing it to be created, use `hasInstance` instead.
|
|
|
|
*/
|
|
|
|
@property (nonatomic, strong, readonly) id<RCTBridgeModule> instance;
|
[ReactNative] Move module info from bridge to RCTModuleData
Summary:
@public
The info about bridge modules (such as id, name, queue, methods...) was spread
across arrays & dictionaries on the bridge, move it into a specific class.
It also removes a lot of information that was statically cached, and now have
the same lifecycle of the bridge.
Also moved RCTModuleMethod, RCTFrameUpdate and RCTBatchedBridge into it's own
files, for organization sake.
NOTE: This diff seems huge, but most of it was just moving code :)
Test Plan:
Tested UIExplorer & UIExplorer tests, Catalyst, MAdMan and Groups. Everything
looks fine.
2015-06-24 23:34:56 +00:00
|
|
|
|
2015-11-25 11:09:00 +00:00
|
|
|
/**
|
|
|
|
* Returns the module method dispatch queue. Note that this will init both the
|
|
|
|
* queue and the module itself if they have not already been created.
|
|
|
|
*/
|
|
|
|
@property (nonatomic, strong, readonly) dispatch_queue_t methodQueue;
|
[ReactNative] Move module info from bridge to RCTModuleData
Summary:
@public
The info about bridge modules (such as id, name, queue, methods...) was spread
across arrays & dictionaries on the bridge, move it into a specific class.
It also removes a lot of information that was statically cached, and now have
the same lifecycle of the bridge.
Also moved RCTModuleMethod, RCTFrameUpdate and RCTBatchedBridge into it's own
files, for organization sake.
NOTE: This diff seems huge, but most of it was just moving code :)
Test Plan:
Tested UIExplorer & UIExplorer tests, Catalyst, MAdMan and Groups. Everything
looks fine.
2015-06-24 23:34:56 +00:00
|
|
|
|
2015-11-25 11:09:00 +00:00
|
|
|
/**
|
2016-03-03 10:20:20 +00:00
|
|
|
* Returns the module config. Calls `gatherConstants` internally, so the same
|
|
|
|
* usage caveats apply.
|
2015-11-25 11:09:00 +00:00
|
|
|
*/
|
|
|
|
@property (nonatomic, copy, readonly) NSArray *config;
|
[ReactNative] Move module info from bridge to RCTModuleData
Summary:
@public
The info about bridge modules (such as id, name, queue, methods...) was spread
across arrays & dictionaries on the bridge, move it into a specific class.
It also removes a lot of information that was statically cached, and now have
the same lifecycle of the bridge.
Also moved RCTModuleMethod, RCTFrameUpdate and RCTBatchedBridge into it's own
files, for organization sake.
NOTE: This diff seems huge, but most of it was just moving code :)
Test Plan:
Tested UIExplorer & UIExplorer tests, Catalyst, MAdMan and Groups. Everything
looks fine.
2015-06-24 23:34:56 +00:00
|
|
|
|
2015-12-03 11:19:45 +00:00
|
|
|
/**
|
|
|
|
* Whether the receiver has a valid `instance` which implements -batchDidComplete.
|
|
|
|
*/
|
|
|
|
@property (nonatomic, assign, readonly) BOOL implementsBatchDidComplete;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether the receiver has a valid `instance` which implements
|
|
|
|
* -partialBatchDidFlush.
|
|
|
|
*/
|
|
|
|
@property (nonatomic, assign, readonly) BOOL implementsPartialBatchDidFlush;
|
|
|
|
|
[ReactNative] Move module info from bridge to RCTModuleData
Summary:
@public
The info about bridge modules (such as id, name, queue, methods...) was spread
across arrays & dictionaries on the bridge, move it into a specific class.
It also removes a lot of information that was statically cached, and now have
the same lifecycle of the bridge.
Also moved RCTModuleMethod, RCTFrameUpdate and RCTBatchedBridge into it's own
files, for organization sake.
NOTE: This diff seems huge, but most of it was just moving code :)
Test Plan:
Tested UIExplorer & UIExplorer tests, Catalyst, MAdMan and Groups. Everything
looks fine.
2015-06-24 23:34:56 +00:00
|
|
|
@end
|