Hylograph.ForceEngine.Registry
- Package
- purescript-hylograph-simulation
- Repository
- afcondon/purescript-hylograph-simulation
Simulation Registry
Named simulation registry for debugging and coordination. Allows tracking multiple simulations by name, useful when:
- Running multiple visualizations simultaneously
- Debugging simulation behavior via browser console
- Coordinating simulations (e.g., pausing main when popup opens)
Usage:
-- Create and register a simulation
sim <- create defaultConfig
register "main-explorer" sim
-- Later, from browser console or debug code
mainSim <- lookup "main-explorer"
case mainSim of
Just s -> stop s
Nothing -> pure unit
-- List all registered simulations
names <- listSimulations
log $ "Running simulations: " <> show names
#AnySimulation Source
data AnySimulationInternal registry storage. Uses existential encoding to store simulations with different row types. The trade-off is we can only perform operations that work on any simulation.
#register Source
register :: forall row linkRow. String -> Simulation row linkRow -> Effect UnitRegister a simulation with a name.
If a simulation with this name already exists, it will be replaced. The old simulation is NOT stopped automatically.
sim <- create defaultConfig
register "call-graph" sim
#unregister Source
unregister :: String -> Effect UnitUnregister a simulation by name.
Does nothing if no simulation with this name exists. The simulation is NOT stopped automatically.
#lookup Source
lookup :: String -> Effect (Maybe AnySimulation)Look up a simulation by name.
WARNING: The returned simulation has an unknown row type. Only use operations that work on any simulation (stop, isRunning, getAlpha). Calling getNodes will require an unsafe cast.
#listSimulations Source
listSimulations :: Effect (Array String)List all registered simulation names.
#clearRegistry Source
clearRegistry :: Effect UnitClear the registry without stopping simulations.
Use stopAll first if you want to stop them.
#debugRegistry Source
debugRegistry :: Effect UnitPrint debug information about all registered simulations.
Designed for use from browser console:
// In browser console:
import('./output/Hylograph.ForceEngine.Registry/index.js').then(m => m.debugRegistry())
#unsafeFromAny Source
unsafeFromAny :: forall row linkRow. AnySimulation -> Simulation row linkRow- Modules
- Hylograph.
Config. Apply - Hylograph.
Config. Force - Hylograph.
Config. Scene - Hylograph.
ForceEngine - Hylograph.
ForceEngine. Core - Hylograph.
ForceEngine. Demo - Hylograph.
ForceEngine. Events - Hylograph.
ForceEngine. Links - Hylograph.
ForceEngine. Registry - Hylograph.
ForceEngine. Render - Hylograph.
ForceEngine. Setup - Hylograph.
ForceEngine. Setup. WASM - Hylograph.
ForceEngine. Simulation - Hylograph.
ForceEngine. Types - Hylograph.
ForceEngine. WASM - Hylograph.
ForceEngine. WASMEngine - Hylograph.
Scene. Engine - Hylograph.
Scene. Handle - Hylograph.
Scene. Rules - Hylograph.
Scene. Types - Hylograph.
Simulation - Hylograph.
Simulation. Emitter - Hylograph.
Simulation. HATS - Hylograph.
Simulation. Scene - Hylograph.
Transition. Consumers - Hylograph.
Transition. Example