-
Notifications
You must be signed in to change notification settings - Fork 0
JSI Modules
JSI exposes C++ functions synchronously to JavaScript. It is a supported generator backend. Use it only for short operations and only after verifying that the target PluginHost can load the generated library.
Current limitation: The enforcing retail configuration tested by the project blocked execution of the generated JSI library. Generation and compilation may still succeed. Use JNI unless JSI has been verified on the exact target environment.
See Requirements and Compatibility for the dated device evidence and technical details.
- JavaScript genuinely needs a synchronous result.
- The operation is short and safe on the JavaScript thread.
- JSI has executed on the target device, firmware, and PluginHost.
Do not use JSI for blocking or long-running work, including file access, network access, locks, or large computations.
supernote-module doctor --type jsiThen create it using Add a Module, choosing JSI Module.
Edit a C++ file below:
local_modules/<package>/android/src/main/cpp/
// @SupernoteExport
double add(double left, double right) {
return left + right;
}Call it synchronously—do not use await:
import FastMath from 'fast-math-jsi';
const total = FastMath.add(20, 22);Errors are synchronous too. The same C/C++ signature rules as JNI apply.
supernote-module validate fast-math-jsi --buildValidation can compile the generated module, but it cannot prove that
PluginHost will execute it. Add --verbose when diagnosing a failed build; see
Troubleshooting for generated log tags and denial messages.