2015-07-28 18:07:45 +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.
|
|
|
|
*/
|
|
|
|
|
2017-04-20 15:20:03 +00:00
|
|
|
#import <Foundation/Foundation.h>
|
2015-07-28 18:07:45 +00:00
|
|
|
|
2017-04-20 15:20:03 +00:00
|
|
|
#import <React/RCTDefines.h>
|
2015-07-28 18:07:45 +00:00
|
|
|
|
2017-04-20 15:20:03 +00:00
|
|
|
#if RCT_DEV
|
|
|
|
|
2017-10-05 02:06:22 +00:00
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
|
2017-04-20 15:20:03 +00:00
|
|
|
@class RCTBridge;
|
2017-05-05 15:32:15 +00:00
|
|
|
@protocol RCTPackagerClientMethod;
|
2017-06-15 18:52:05 +00:00
|
|
|
@protocol RCTPackagerConnectionConfig;
|
2017-04-20 15:20:03 +00:00
|
|
|
|
|
|
|
/**
|
2017-10-05 02:06:22 +00:00
|
|
|
* Encapsulates connection to React Native packager.
|
|
|
|
* Dispatches messages from websocket to message handlers that must implement
|
|
|
|
* <RCTPackagerClientMethod> protocol.
|
|
|
|
* Message dispatch is performed on the main queue, unless message handler
|
|
|
|
* provides its own queue by overriding "methodQueue" method.
|
2017-04-20 15:20:03 +00:00
|
|
|
*/
|
|
|
|
@interface RCTPackagerConnection : NSObject
|
|
|
|
|
2017-10-05 02:06:22 +00:00
|
|
|
+ (void)checkDefaultConnectionWithCallback:(void (^)(BOOL isRunning))callback
|
|
|
|
queue:(dispatch_queue_t)queue;
|
|
|
|
|
2017-06-15 18:52:05 +00:00
|
|
|
+ (instancetype)connectionForBridge:(RCTBridge *)bridge;
|
|
|
|
- (instancetype)initWithConfig:(id<RCTPackagerConnectionConfig>)config;
|
2017-05-05 15:32:15 +00:00
|
|
|
- (void)addHandler:(id<RCTPackagerClientMethod>)handler forMethod:(NSString *)name;
|
2017-10-05 02:06:22 +00:00
|
|
|
- (void)stop;
|
2015-09-04 10:44:55 +00:00
|
|
|
|
2015-07-28 18:07:45 +00:00
|
|
|
@end
|
2017-04-20 15:20:03 +00:00
|
|
|
|
2017-10-05 02:06:22 +00:00
|
|
|
NS_ASSUME_NONNULL_END
|
|
|
|
|
2017-04-20 15:20:03 +00:00
|
|
|
#endif
|