@expofp/floorplan
Version:
Interactive floor plan library for expos and events
28 lines • 1.59 kB
TypeScript
/**
* A stable object that forwards every operation to whatever instance is live
* at the moment of access — the mechanism behind the one-live-plan contract
* (ADR-0011). Importers hold the proxy forever; a plan swap replaces the
* instance underneath it, and the dead window between `destroy()` and the next
* `load()` (when `resolve` yields nothing) makes every access throw rather than
* silently serve a dead object.
*
* MobX 5 tolerates this because its administration lives on the instance and
* every trap dereferences afresh — proven end-to-end by the spike recorded in
* `docs/2026-08-27-plan-swap-proxy-spike-verdict.md` and locked in by
* `store/live-store.spec.tsx`. The one thing it cannot paper over: a reaction
* created before a swap stays subscribed to the old instance, which is why
* `destroy()` disposes every reaction it owns.
*
* Used by the store barrel (`store/live-store.ts`) and by the event-data
* bindings that importers hold as objects rather than call as functions —
* `data/index.ts` and `tools/settings.ts`.
*
* Note that proxy identity is not instance identity — `store.uiState` is not
* `===` the `uiState` export. No store-object identity comparisons exist in
* `src` today; don't introduce one.
*
* @param name How the proxy is known to importers, used in the dead-window error.
* @param resolve Yields the live instance, or a nullish value while none is.
*/
export declare function createSwappableProxy<T extends object>(name: string, resolve: () => T | null | undefined): T;
//# sourceMappingURL=swappable-proxy.d.ts.map