Skip to content

JSI Modules

s edited this page Aug 1, 2026 · 5 revisions

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.

When JSI is appropriate

  • 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.

Generate the module

supernote-module doctor --type jsi

Then create it using Add a Module, choosing JSI Module.

Write and call the function

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.

Validate

supernote-module validate fast-math-jsi --build

Validation 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.

Clone this wiki locally