2015-09-18 15:01:21 -07:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
*
|
2018-02-16 18:24:55 -08: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 15:01:21 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
|
|
|
|
@class RCTBridge;
|
|
|
|
|
|
|
|
typedef NS_ENUM(NSUInteger, RCTFunctionType) {
|
|
|
|
RCTFunctionTypeNormal,
|
|
|
|
RCTFunctionTypePromise,
|
2016-09-05 07:32:20 -07:00
|
|
|
RCTFunctionTypeSync,
|
2015-09-18 15:01:21 -07:00
|
|
|
};
|
|
|
|
|
2017-04-27 11:49:49 -07: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 15:01:21 -07:00
|
|
|
@protocol RCTBridgeMethod <NSObject>
|
|
|
|
|
2017-07-24 06:46:01 -07:00
|
|
|
@property (nonatomic, readonly) const char *JSMethodName;
|
2015-09-18 15:01:21 -07:00
|
|
|
@property (nonatomic, readonly) RCTFunctionType functionType;
|
|
|
|
|
2016-09-05 07:32:20 -07:00
|
|
|
- (id)invokeWithBridge:(RCTBridge *)bridge
|
|
|
|
module:(id)module
|
|
|
|
arguments:(NSArray *)arguments;
|
2015-09-18 15:01:21 -07:00
|
|
|
|
|
|
|
@end
|