Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mention emnapi in documentation #17515

Merged
merged 4 commits into from
Feb 23, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ JavaScript and compiled C or C++:
created with:

- :ref:`Embind or WebIDL-Binder<interacting-with-code-binding-cpp>`
- :ref:`Emnapi (Node-API)<interacting-with-code-emnapi>`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it makes sense to list it here. Emnapi is specific set of bindings for node API, right? Not a method of writing new binding?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my understanding, developers cannot use Node-API to write bindings in emscripten before emnapi exists, in a sense it is a new way to write bindings in emscripten, so it is listed here like embind.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the mention below is ok, but I would remove this one. The main part of this doc is for officially supported things in the emscripten repo. But adding a mention near the end is ok for unofficial stuff (while mentioning it is unofficial, as I see that you do).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


- Call JavaScript functions from **C/C++**:

Expand Down Expand Up @@ -798,6 +799,16 @@ for defining the binding:
of one tool over the other will usually be based on which is the most
natural fit for the project and its build system.

.. _interacting-with-code-emnapi:

Binding C/C++ and JavaScript — Emnapi (Node-API for Emscripten)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that - some kind of unicode - ? It looks different to the other ones in this file? Can we stick the to ascii -?

Copy link
Contributor Author

@toyobayashi toyobayashi Jul 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks different to the other ones in this file

It was copied from here

Binding C++ and JavaScript — WebIDL Binder and Embind
======================================================

I use Ctrl + F in VSCode, and then find there are many in this file. I think I should leave them the same.

===============================================================

`Emnapi`_ is an unofficial `Node-API`_ implementation for Emscripten.
If you prefer Node-API, or you would like to port your Node.js addon
written in Node-API to WebAssembly, you can give it a try. See
`Emnapi documentation`_ for more details.

.. _library.js: https://github.com/emscripten-core/emscripten/blob/main/src/library.js
.. _test_js_libraries: https://github.com/emscripten-core/emscripten/blob/1.29.12/tests/test_core.py#L5043
.. _src/deps_info.json: https://github.com/emscripten-core/emscripten/blob/main/src/deps_info.json
Expand All @@ -808,3 +819,6 @@ for defining the binding:
.. _tests/test_core.py: https://github.com/emscripten-core/emscripten/blob/1.29.12/tests/test_core.py#L4597
.. _Box2D: https://github.com/kripken/box2d.js/#box2djs
.. _Bullet: https://github.com/kripken/ammo.js/#ammojs
.. _Emnapi: https://github.com/toyobayashi/emnapi
.. _Node-API: https://nodejs.org/dist/latest-v16.x/docs/api/n-api.html
.. _Emnapi documentation: https://emnapi-docs.vercel.app/guide/getting-started.html