From 6651e73404e99c71c10a521215f2a1babcf9615f Mon Sep 17 00:00:00 2001 From: Marc Rousavy Date: Sat, 5 Oct 2024 17:22:56 +0200 Subject: [PATCH] docs: Explain that HybridObjects can be created from JS --- docs/docs/hybrid-objects.md | 2 +- docs/docs/what-is-nitro.md | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/docs/hybrid-objects.md b/docs/docs/hybrid-objects.md index a96163365..d0a417ca9 100644 --- a/docs/docs/hybrid-objects.md +++ b/docs/docs/hybrid-objects.md @@ -38,7 +38,7 @@ class HybridMath : HybridMathSpec { ## Working with Hybrid Objects -Hybrid Objects can be created using `createHybridObject(...)` if they have been registered on the native side: +Hybrid Objects can be instantiated from JS using `createHybridObject(...)`: ```ts const math = NitroModules.createHybridObject("Math") diff --git a/docs/docs/what-is-nitro.md b/docs/docs/what-is-nitro.md index 6e449a2ae..5dacaf211 100644 --- a/docs/docs/what-is-nitro.md +++ b/docs/docs/what-is-nitro.md @@ -36,6 +36,13 @@ class HybridMath : HybridMathSpec { +This Hybrid Object can then be accessed directly from JS: + +```ts +const math = NitroModules.createHybridObject('Math') +const result = math.add(5, 7) +``` + ## Performance Nitro is all about **performance**. [This benchmark](https://github.com/mrousavy/NitroBenchmarks) compares the total execution time when calling a single native method 100.000 times: