mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-20 02:56:10 +00:00
c4a2a91578
A tester reported that their own plugin, fine on the web, slowed the app down badly on a phone. A sandboxed plugin iframe keeps running its timers, polling and animation even off screen, and on a phone it shares the WebView's main thread with the whole app, so a heavy one janks everything. The frame now watches whether it is on screen and the app in the foreground (IntersectionObserver + page visibility) and forwards it as trek:visibility, so a plugin can pause its work while hidden; the design kit exposes trek.onVisibility / trek.isVisible and pauses its own CSS animations via data-hidden. On a phone a dashboard-widget plugin scrolled well out of view is suspended outright: its iframe is unmounted and a placeholder holds the widget's height, so an offscreen widget costs nothing and remounts when it scrolls back.