@nativescript/windows-napi 1.0.0-beta.22 → 1.0.0-beta.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -0
- package/package.json +1 -1
- package/windows.win32-arm64-msvc.node +0 -0
- package/windows.win32-x64-msvc.node +0 -0
package/README.md
CHANGED
|
@@ -42,6 +42,19 @@ The host executable's manifest must declare `<maxversiontested Id="10.0.18362.0"
|
|
|
42
42
|
`electron.exe` does and `node.exe` doesn't, so `XamlWindow` throws in plain Node. XAML events run
|
|
43
43
|
from the host's message loop, so a host with its own UI loop needs no `pumpMessages`.
|
|
44
44
|
|
|
45
|
+
## Embedding outside Node
|
|
46
|
+
|
|
47
|
+
Any host that provides Node-API can load the addon: load the `.node` file as a DLL and call its
|
|
48
|
+
`napi_register_module_v1(env, exports)`. The addon takes its `napi_*` functions from the host
|
|
49
|
+
executable, as in Node. A host whose executable doesn't export them sets `NAPI_HOST_MODULES`
|
|
50
|
+
before loading the addon: the modules that do, separated by `;`, in priority order. Each function
|
|
51
|
+
comes from the first module that exports it.
|
|
52
|
+
|
|
53
|
+
React Native for Windows is one: `@nativescript/react-native` runs the addon in a Hermes runtime,
|
|
54
|
+
where `hermes.dll` has the engine half of Node-API (`js_native_api.h`) and the module itself
|
|
55
|
+
implements Node's half (`node_api.h`: threadsafe functions, cleanup hooks, buffers). It sets
|
|
56
|
+
`NAPI_HOST_MODULES=<its DLL>;<hermes.dll>`.
|
|
57
|
+
|
|
45
58
|
## Development
|
|
46
59
|
|
|
47
60
|
```sh
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|