Function: bindStateToUrl()
bindStateToUrl(
bindings,options):UrlStateController
Defined in: src/serialization/urlState.ts:258
Bind a set of explorable controls to the URL hash.
Each binding exposes a stable id, a getter and a setter. On bind the current
URL state is applied to the controls (so a shared link restores the view),
and save() captures the controls back into the URL. When listen is on,
the controls also follow back/forward navigation through hashchange.
Parameters
bindings
readonly UrlStateBinding[]
One UrlStateBinding per control.
options
BindUrlStateOptions = {}
Bind-time behavior (replace, restoreOnBind, listen).
Returns
A UrlStateController to capture, save, restore and dispose.
Example
const controller = bindStateToUrl([
{ id: 'p', get: () => point.getPoint(), set: (v) => point.setPoint(v as Vector3Tuple) },
{ id: 's', get: () => slider.getValue(), set: (v) => slider.setValue(v as number) },
]);
// after a drag:
controller.save();