Chapter 2 of 9
Boot & render
Rendering sets graph roots and sends a batch to the plugin. The first emit is easy to lose on navigation — plan for retries.
render + didEmit
function ensureEmit() {
if (wax.didEmit()) return true;
if (typeof wax.reemitLast === "function") wax.reemitLast("retry");
return wax.didEmit();
}
function renderGraph() {
const tone = wax.mul(wax.cycle(440), 0.15);
wax.render(tone, tone);
ensureEmit();
}
Poke schedule
After boot, re-run renderGraph() on a short delay ladder so Project URL loads and WebView lifecycle do not swallow the first batch:
function poke() {
WaxNative.keepAlive();
renderGraph();
if (!wax.didEmit()) setTimeout(() => { renderGraph(); ensureEmit(); }, 40);
}
[50, 150, 400, 800, 1500, 2500, 4000].forEach((ms) => setTimeout(poke, ms));
Do not
- Call
render()once at the bottom of a synchronous inline script with no deferred poke. - Pass
onBatch/ custom emit tocreate()unless you emit yourself —didEmit()will stay false. - Hand-roll JUCE emit chains copied from internal bridge code.
Try it
Full page: Minimal tone demo
Example code
Snippets from this lesson — combine in your Custom Page.
Loading…