newsmemory-ios-sdk/Frameworks/ReactCommon.xcframework/ios-arm64/Headers/ReactCommon/TurboCxxModule.h

52 lines
1.4 KiB
C
Raw Normal View History

2024-05-02 15:08:24 +00:00
/*
2024-10-29 07:36:43 +00:00
* Copyright (c) Meta Platforms, Inc. and affiliates.
2024-05-02 15:08:24 +00:00
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include <memory>
#include <vector>
#include <cxxreact/CxxModule.h>
#include "TurboModule.h"
namespace facebook {
namespace react {
/**
* A helper class to convert the legacy CxxModule instance to a TurboModule
* instance. This should be used only for migration purpose (to TurboModule),
* since it's not very performant due to a lot of back-and-forth value
* conversions between folly::dynamic and jsi::Value.
*/
class JSI_EXPORT TurboCxxModule : public TurboModule {
public:
TurboCxxModule(
std::unique_ptr<facebook::xplat::module::CxxModule> cxxModule,
std::shared_ptr<CallInvoker> jsInvoker);
2024-10-29 07:36:43 +00:00
facebook::jsi::Value get(
2024-05-02 15:08:24 +00:00
facebook::jsi::Runtime &runtime,
const facebook::jsi::PropNameID &propName) override;
2024-10-29 07:36:43 +00:00
std::vector<facebook::jsi::PropNameID> getPropertyNames(
facebook::jsi::Runtime &runtime) override;
2024-05-02 15:08:24 +00:00
jsi::Value invokeMethod(
jsi::Runtime &runtime,
const std::string &methodName,
const jsi::Value *args,
size_t count);
private:
std::vector<facebook::xplat::module::CxxModule::Method> cxxMethods_;
std::unique_ptr<facebook::xplat::module::CxxModule> cxxModule_;
};
} // namespace react
} // namespace facebook