RCTPackagerClient.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. */
  7. #import <React/RCTDefines.h>
  8. #if RCT_DEV // Only supported in dev mode
  9. @class RCTPackagerClientResponder;
  10. @class RCTReconnectingWebSocket;
  11. #if defined(__cplusplus)
  12. extern "C" {
  13. #endif
  14. extern const int RCT_PACKAGER_CLIENT_PROTOCOL_VERSION;
  15. #if defined(__cplusplus)
  16. }
  17. #endif
  18. @protocol RCTPackagerClientMethod <NSObject>
  19. - (void)handleRequest:(NSDictionary<NSString *, id> *)params withResponder:(RCTPackagerClientResponder *)responder;
  20. - (void)handleNotification:(NSDictionary<NSString *, id> *)params;
  21. @optional
  22. /** By default object will receive its methods on the main queue, unless this method is overridden. */
  23. - (dispatch_queue_t)methodQueue;
  24. @end
  25. @interface RCTPackagerClientResponder : NSObject
  26. - (instancetype)initWithId:(id)msgId socket:(RCTReconnectingWebSocket *)socket;
  27. - (void)respondWithResult:(id)result;
  28. - (void)respondWithError:(id)error;
  29. @end
  30. #endif