Skip to content

Commit

Permalink
Add instructions for unloading interop.
Browse files Browse the repository at this point in the history
  • Loading branch information
nmoinvaz committed Aug 17, 2024
1 parent 571712e commit dea5476
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ cmake -S . -B build
cmake --build build --config Debug
```

The target architecture of the shared library must match the architecture of the DIRECT client you are using. For example, if you are using host.exe for 32-bit Windows, then you must configure for x86 by using CMake argument `-A Win32`. If configuring on Windows, it is recommended that you statically link against MSVC runtime using `-D CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded` to prevent the user from having to install the Visual C++ runtime separately.
The target architecture of the shared library must match the architecture of the DIRECT client you are using. For example, if you are using host.exe for 32-bit Windows, then you must configure for x86 by using CMake argument `-A Win32`. If configuring on Windows, it is recommended that you statically link against MSVC runtime using `-D CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded` to prevent the user from having to install the Visual C++ runtime separately. To build on macOS, using Xcode, supply the `-G Xcode` argument.

### Setup Instructions

Expand All @@ -44,12 +44,16 @@ First copy the shared library to the directory where you intended to load it fro
If you intend to use the interop with-in JavaScript use the following steps:

1. Copy `Simple.js` and `SimpleExample.js` from the `js` directory to a directory in your skin called `src/interop`.
2. Load the example code and interop using `app.loadInterop`:
2. Load the example code and interop in `/src/App.jsx` using `app.loadInterop`:
```js
require("./interop/SimpleExample");
import "./interop/SimpleExample";

const simplePath = "{moduleAppDirectory}{libraryPrefix}simple.{libraryExtension}";
app.loadInterop("simple", app.expandString(simplePath));
const simplePath = app.expandString("{moduleAppDirectory}{libraryPrefix}simple.{libraryExtension}");
app.loadInterop("simple", simplePath);
```
3. Call `app.unloadInterop` before `skinWindow.close()` in `src/App.jsx`:
```js
app.unloadInterop("simple", simplePath);
```
3. Run `host` application with `--devtools --disablesecurity` (during production if you sign the dll you won't need this).
4. If it integrated properly, you will see the following lines in console window. <br/><img src="screenshots/console.png">

0 comments on commit dea5476

Please sign in to comment.