JBrowser Source Docs

jbrowser.engine.lifecycle

Generated from the source code of JBrowser 1.5.4.

jbrowser/engine/lifecycle.py · 240 lines

Tab lifecycle: out-of-sight render throttling and the smart memory saver (tab sleeping).

Throttle — exactly 5 s after a card leaves the viewport (or its space is hidden) the page is marked hidden (Chromium stops producing frames, rAF halts, timers are throttled) and, when safe, frozen (JS tasks & timers paused). Entering the viewport restores full throughput immediately. Sleep — after the preset inactivity period a background card is hibernated (renderer discarded, static snapshot shown) unless the smart-protection guard finds playing media, WebSockets/WebRTC, unsaved edits, beforeunload handlers, downloads or DevTools.

Constants#

Name Value
THROTTLE_DELAY_MS 5000
SCAN_INTERVAL_MS 20000

LifecycleManager#

class LifecycleManager(QObject)source
LifecycleManager(ctx: 'AppContext', parent: QObject | None=None)

Signals

Signal Arguments
aboutToThrottle (str)
aboutToSleep (str)
woke (str)
sleepBlocked (str, str)

LifecycleManager.throttle_enabled#

property throttle_enabledsource

LifecycleManager.sleep_minutes#

sleep_minutes() -> int | Nonesource

LifecycleManager.is_in_view#

is_in_view(tab_id: str) -> boolsource

LifecycleManager.set_in_view#

set_in_view(tab_id: str, visible: bool, render_visible: bool) -> Nonesource

Reported by canvases whenever a card enters/leaves the visible viewport.

LifecycleManager.scan#

scan() -> Nonesource

LifecycleManager.try_sleep#

try_sleep(tab: Tab, manual: bool=True) -> Nonesource

LifecycleManager.wake#

wake(tab_id: str) -> Nonesource

LifecycleManager.sleep_inactive_now#

sleep_inactive_now() -> intsource

LifecycleManager.wake_all#

wake_all(space_id: str | None=None) -> Nonesource