Skip to content

Commit

Permalink
docs: Explain that HybridObjects can be created from JS
Browse files Browse the repository at this point in the history
  • Loading branch information
mrousavy committed Oct 5, 2024
1 parent 56a2844 commit 6651e73
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/docs/hybrid-objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -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>("Math")
Expand Down
7 changes: 7 additions & 0 deletions docs/docs/what-is-nitro.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ class HybridMath : HybridMathSpec {
</div>
</div>

This Hybrid Object can then be accessed directly from JS:

```ts
const math = NitroModules.createHybridObject<Math>('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:
Expand Down

0 comments on commit 6651e73

Please sign in to comment.