JavaScript Samples (Beta)

The SDK archive includes a beta JavaScript package in javascript. It provides an ES module API backed by WebAssembly and can be used from browsers, Electron renderer processes, Electron main processes, and Node.js. The package includes browser samples for the same core data-access patterns as the native SDK.

For latency-critical desktop integrations, prefer the native C, C++, C#, or Python SDK clients for the target platform. The JavaScript package is most appropriate when your application is already JavaScript-based or WebAssembly deployment is required.

Running the Samples

From the SDK archive’s javascript directory, run:

python3 serve_samples.py

Then open:

http://127.0.0.1:8765/samples/

The sample server adds the cross-origin isolation headers required by the WebAssembly pthread runtime. Opening the files directly from disk will not work for browser samples that need SharedArrayBuffer.

Available Samples

The JavaScript sample folder includes:

  • Polling, asynchronous wait-style, and callback-based data-access samples.

  • An auto-start sample that requests the Beam Eye Tracker application to launch and start tracking.

  • A cockpit-view sample that uses the sim game camera API from a browser page.

Package Layout

The public package entry point is index.js and TypeScript declarations are provided in index.d.ts. Keep the generated lib directory next to index.js because it contains the WebAssembly module and JavaScript runtime glue loaded by the package.