Overhaul Sessioning

This commit was merged in pull request #55.
This commit is contained in:
David Rodenkirchen
2026-02-23 15:15:39 +01:00
parent 57c578a44b
commit b47eefe615
25 changed files with 216 additions and 179 deletions
@@ -0,0 +1,17 @@
from typing import Callable
class RefreshService:
"""
rio.Components can subscribe to this service with their on_populate method.
Those methods get called whenever a overall refresh is needed. Usually when the user logs in or out.
"""
def __init__(self) -> None:
self.subscribers: set[Callable] = set()
def subscribe(self, refresh_cb: Callable) -> None:
self.subscribers.add(refresh_cb)
async def trigger_refresh(self) -> None:
for refresh_cb in self.subscribers:
await refresh_cb()