iOS: introduce RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD() macro to provide the return type of a sync method
Summary: This provides a way to customize the return type of a sync exported method, instead of just using `id`. ``` RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSString *, sync1:(NSString *)x) { return @"hello"; } ``` The return type needs to be a sub type of `id` - so scalars like `double` won't work (the bridge will crash). Differential Revision: D6068884 fbshipit-source-id: 43a98141f1d0aef335aa0b33a24219f8e574e58b
This commit is contained in:
parent
dc16150bae
commit
47bfbbb1d3
|
@ -171,7 +171,11 @@ RCT_EXTERN void RCTRegisterModule(Class); \
|
|||
* is currently not supported.
|
||||
*/
|
||||
#define RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(method) \
|
||||
RCT_REMAP_BLOCKING_SYNCHRONOUS_METHOD(, method)
|
||||
RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(id, method)
|
||||
|
||||
#define RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(returnType, method) \
|
||||
RCT_REMAP_BLOCKING_SYNCHRONOUS_METHOD(, returnType, method)
|
||||
|
||||
|
||||
/**
|
||||
* Similar to RCT_EXPORT_METHOD but lets you set the JS name of the exported
|
||||
|
@ -193,9 +197,9 @@ RCT_EXTERN void RCTRegisterModule(Class); \
|
|||
* executeQuery:(NSString *)query parameters:(NSDictionary *)parameters)
|
||||
* { ... }
|
||||
*/
|
||||
#define RCT_REMAP_BLOCKING_SYNCHRONOUS_METHOD(js_name, method) \
|
||||
#define RCT_REMAP_BLOCKING_SYNCHRONOUS_METHOD(js_name, returnType, method) \
|
||||
_RCT_EXTERN_REMAP_METHOD(js_name, method, YES) \
|
||||
- (id)method;
|
||||
- (returnType)method;
|
||||
|
||||
/**
|
||||
* Use this macro in a private Objective-C implementation file to automatically
|
||||
|
|
Loading…
Reference in New Issue