Fundamentals
Export Targets
Code Export
Patcher UI
Special Topics
RNBO Raspberry Pi OSCQuery Runner
Working with TypeScript
The @rnbo/js library includes TypeScript types, and integrates smoothly with TypeScript projects.
If you're working with TypeScript, @rnbo/js includes type definitions to support integration with TypeScript tools. After installing the @rnbo/js package with npm install @rnbo/js, there are no extra steps to get the RNBO TypeScript definitions. The rnbo.webaudio.d.ts file contains TypeScript definitions for @rnbo/js.
Using TypeScript allows you to use import to include the @rnbo/js package. It also allows you to explore the structure of objects in @rnbo/js through autocomplete tools that leverage TypeScript definition files.
import { createDevice, IPatcher, MessageEvent } from "@rnbo/js";
let patcher: IPatcher;
let context: AudioContext;
context = new AudioContext();
// Somehow initialize your patcher
const device = await createDevice({
patcher: patcher,
context: context
});The TypeScript definitions for @rnbo/js also include type definitions for the exported patcher itself as an IPatcher type. If you enable the tsconfig option resolveJsonModule, then you can import an exported patcher JSON directly. Its structure will be available to autocomplete and other typescript tools.