Skip to content

Commit 6f01473

Browse files
committed
Passing callInvoker down
1 parent e510ada commit 6f01473

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

packages/host/ios/NodeApiHostModuleProvider.mm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#import "CxxNodeApiHostModule.hpp"
22
#import "WeakNodeApiInjector.hpp"
3+
#include "RuntimeNodeApiAsync.hpp"
34

45
#define USE_CXX_TURBO_MODULE_UTILS 0
56
#if defined(__has_include)
@@ -27,6 +28,7 @@ + (void)load {
2728
facebook::react::registerCxxModuleToGlobalModuleMap(
2829
callstack::nodeapihost::CxxNodeApiHostModule::kModuleName,
2930
[](std::shared_ptr<facebook::react::CallInvoker> jsInvoker) {
31+
callstack::nodeapihost::setCallInvoker(jsInvoker);
3032
return std::make_shared<callstack::nodeapihost::CxxNodeApiHostModule>(
3133
jsInvoker);
3234
});

packages/host/scripts/generate-weak-node-api-injector.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ const IMPLEMENTED_RUNTIME_FUNCTIONS = [
1313
"napi_is_buffer",
1414
"napi_get_buffer_info",
1515
"napi_create_external_buffer",
16+
"napi_create_async_work",
17+
"napi_queue_async_work",
18+
"napi_delete_async_work",
19+
"napi_cancel_async_work",
1620
];
1721

1822
/**
@@ -25,6 +29,7 @@ export function generateSource(functions: FunctionDecl[]) {
2529
#include <dlfcn.h>
2630
#include <weak_node_api.hpp>
2731
#include <RuntimeNodeApi.hpp>
32+
#include <RuntimeNodeApiAsync.hpp>
2833
2934
#if defined(__APPLE__)
3035
#define WEAK_NODE_API_LIBRARY_NAME "@rpath/weak-node-api.framework/weak-node-api"
@@ -61,6 +66,9 @@ export function generateSource(functions: FunctionDecl[]) {
6166
.join("\n")}
6267
});
6368
}
69+
void initialize(const std::shared_ptr<facebook::react::CallInvoker>& invoker) {
70+
callstack::nodeapihost::initialize(invoker);
71+
}
6472
} // namespace callstack::nodeapihost
6573
`;
6674
}

0 commit comments

Comments
 (0)