Chapter 5 of 10
Presets
Companion lab · Read full chapter in the guide →
Store one JSON blob per app via DataTree; apply only after a successful emit, then re-run renderDevice().
In this lab you will
collect()/apply()with{ schema, params }- Defer DataTree init ~600 ms on native pages
- Gate preset apply on
wax.didEmit()
Minimal pattern
function collect() {
return { schema: 1, params: { cutoffHz, q, master } };
}
function apply(raw) {
const p = (raw && raw.params) || raw;
cutoffHz = p.cutoffHz ?? cutoffHz;
syncUIFromVars();
renderDevice();
}
Try it
Preset recall demo · production: DataTree + APP_NAME
Example code
Loading…