2015-09-18 22:01:21 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
*
|
2018-02-17 02:24:55 +00:00
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2015-09-18 22:01:21 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
|
|
|
|
@class RCTBridge;
|
|
|
|
|
|
|
|
typedef NS_ENUM(NSUInteger, RCTFunctionType) {
|
|
|
|
RCTFunctionTypeNormal,
|
|
|
|
RCTFunctionTypePromise,
|
2016-09-05 14:32:20 +00:00
|
|
|
RCTFunctionTypeSync,
|
2015-09-18 22:01:21 +00:00
|
|
|
};
|
|
|
|
|
2017-04-27 18:49:49 +00:00
|
|
|
static inline const char *RCTFunctionDescriptorFromType(RCTFunctionType type) {
|
|
|
|
switch (type) {
|
|
|
|
case RCTFunctionTypeNormal:
|
|
|
|
return "async";
|
|
|
|
case RCTFunctionTypePromise:
|
|
|
|
return "promise";
|
|
|
|
case RCTFunctionTypeSync:
|
|
|
|
return "sync";
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-09-18 22:01:21 +00:00
|
|
|
@protocol RCTBridgeMethod <NSObject>
|
|
|
|
|
2017-07-24 13:46:01 +00:00
|
|
|
@property (nonatomic, readonly) const char *JSMethodName;
|
2015-09-18 22:01:21 +00:00
|
|
|
@property (nonatomic, readonly) RCTFunctionType functionType;
|
|
|
|
|
2016-09-05 14:32:20 +00:00
|
|
|
- (id)invokeWithBridge:(RCTBridge *)bridge
|
|
|
|
module:(id)module
|
|
|
|
arguments:(NSArray *)arguments;
|
2015-09-18 22:01:21 +00:00
|
|
|
|
|
|
|
@end
|