Files
nitro/packages/react-native-nitro-modules/cpp/entrypoint/InstallNitro.cpp
T
Marc RousavyandGitHub dc8f8668f4 feat: Make Nitro itself a Nitro Module and add old-architecture support 🔥 (#175)
* feat: Create `HybridNitroModulesProxy`

* feat: Create `InstallNitro`

* docs: Create `entry-point.md` docs

* fix: Create `JSIConverter<HostObject>` (for BoxedHybridObject)

* Update NitroModulesProxy.ts

* feat: Refactor JS for new module

* feat: Refactor JS again

* feat: Create iOS TurboModule that installs Nitro

* feat: Implement `install()` for old arch (iOS)

* chore: Format

* feat: Implement TurboModule `install()` on Android

* fix: Use `CallInvokerHolderImpl`

* feat: Add CI that tests the build for old architecture

* fix: Fix iOS CI

* fix: Fix CI

* fix: Exclude RN `.so` libraries (like `libjsi.so`) from `packagingOptions`
2024-10-07 15:47:31 +02:00

29 lines
808 B
C++

//
// InstallNitro.cpp
// NitroModules
//
// Created by Marc Rousavy on 05.10.24
//
#include "InstallNitro.hpp"
#include "HybridNitroModulesProxy.hpp"
namespace margelo::nitro {
void install(jsi::Runtime& runtime, std::shared_ptr<Dispatcher> dispatcher) {
// Registers a Dispatcher for Nitro to call back into the JS Runtime.
// This allows creating Promises and calling back to JS.
Dispatcher::installRuntimeGlobalDispatcher(runtime, dispatcher);
// Installs NitroModulesProxy itself into the Runtime's global.
install(runtime);
}
void install(jsi::Runtime& runtime) {
// Installs global.NitroModulesProxy
auto proxy = std::make_shared<HybridNitroModulesProxy>();
runtime.global().setProperty(runtime, "NitroModulesProxy", proxy->toObject(runtime));
}
} // namespace margelo::nitro