perf: add destroy() lifecycle to all mode modules to prevent resource leaks

Mode modules were leaking EventSource connections, setInterval timers,
and setTimeout timers on every mode switch, causing progressive browser
sluggishness. Added destroy() to 8 modules missing it (meshtastic,
bluetooth, wifi, bt_locate, sstv, sstv-general, websdr, spy-stations)
and centralized all destroy calls in switchMode() via a moduleDestroyMap
that cleanly tears down only the previous mode.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Smittix
2026-02-27 19:18:13 +00:00
parent 4a38fde21c
commit 2723d91526
9 changed files with 1063 additions and 956 deletions
File diff suppressed because it is too large Load Diff