src.nth.io/

summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorLuke Hoersten <[email protected]>2026-06-21 11:06:55 -0500
committerLuke Hoersten <[email protected]>2026-06-21 11:06:55 -0500
commit000ab3aded7003695af49a9a11a56b8655290133 (patch)
tree2080bda76bc5f8ff06b9b9c7f0fabf20c7902805 /main
parent6c30928dcac2b028ae0323b98c40c0bb0600ff1b (diff)
scrypted: implement StartStop for proper lifecycle UI + clean tear-down
The Scripts 'Status and Controls' panel previously rendered Unknown because the Provider exposed no lifecycle interface. STOP / START in that panel didn't do anything useful — Scrypted's only option was to unload the script entirely, which left the user's re-paste flow relying on the constructor-time globalThis cleanup hack (and even that didn't cover in-flight streams until 1ce49d3). This commit makes the panel real: class ScryptedViewportProvider ... implements ..., StartStop - async start() : drain shutdown cleaners, bootstrap, running=true - async stop() : drain shutdown cleaners, clear viewport+listener+ stream maps, running=false Both methods are idempotent (no-op when already in target state). The constructor calls start() automatically so script load still bootstraps without user action. The private start() method that did the actual provisioning is renamed to bootstrap() to free up the public name for the StartStop contract. registerShutdownCleaners is renamed to drainShutdownCleaners and now takes a 'reason' label so the log line distinguishes 'start: tearing down N resources' (previous load) from 'stop: tearing down N resources' (user-driven). Effect on the workflow the user described: 1. Click STOP in the Scripts UI → stop() drains every resource (streams, listeners, intervals) the provider currently holds. 2. Re-paste the new script. 3. New constructor runs → start() drains anything left behind → bootstrap re-discovers children + re-attaches listeners → ready. No more accumulating ghosts of prior loads.
Diffstat (limited to 'main')
0 files changed, 0 insertions, 0 deletions