pub struct WebViewRegistry { /* private fields */ }Expand description
Per-app web-view service. Registered in app-state by
TeksiloAppBuilderWebViewExt::install_web_view (in the teksilo umbrella
crate); reachable from any build() / handler via
ctx.app_state::<WebViewRegistry>(). Cloneable; clones share the same
backend and event-callback map.
Implementations§
Source§impl WebViewRegistry
impl WebViewRegistry
Sourcepub fn new<B: WebViewBackend + 'static>(backend: B) -> Self
pub fn new<B: WebViewBackend + 'static>(backend: B) -> Self
Build a registry wrapping backend.
Sourcepub fn open(
&self,
web_view_id: WebViewId,
window_id: TeksiloWindowId,
parent: Option<ParentHandle>,
attrs: WebViewAttributes,
poster: Option<Arc<dyn AppEventPoster>>,
on_event: impl FnMut(WebViewEvent, &mut EventContext<'_>) + 'static,
) -> Box<dyn WebViewHandle>
pub fn open( &self, web_view_id: WebViewId, window_id: TeksiloWindowId, parent: Option<ParentHandle>, attrs: WebViewAttributes, poster: Option<Arc<dyn AppEventPoster>>, on_event: impl FnMut(WebViewEvent, &mut EventContext<'_>) + 'static, ) -> Box<dyn WebViewHandle>
Open a native subview and register the widget’s event callback in one
step. Returns the live WebViewHandle (dropped on widget removal).
Sourcepub fn deliver(&self, payload: WebViewEventPayload, ctx: &mut EventContext<'_>)
pub fn deliver(&self, payload: WebViewEventPayload, ctx: &mut EventContext<'_>)
Route a backend-produced payload to its registered widget callback.
Called by teksilo-app from the AppEvent::External arm. Dropped
silently if the callback was already purged (window/widget gone).
Sourcepub fn unregister(&self, web_view_id: WebViewId)
pub fn unregister(&self, web_view_id: WebViewId)
Drop the registration for a single web view (widget removed).
Sourcepub fn purge_window(&self, window_id: TeksiloWindowId)
pub fn purge_window(&self, window_id: TeksiloWindowId)
Drop every registration owned by window_id. Called by
teksilo-app’s window-close path so callbacks capturing widget state
cannot fire into a torn-down tree. Mirrors
FileDialogHandle::purge_window.
Sourcepub fn registered_count(&self) -> usize
pub fn registered_count(&self) -> usize
Number of registered web views. Test helper.
Trait Implementations§
Source§impl Clone for WebViewRegistry
impl Clone for WebViewRegistry
Source§fn clone(&self) -> WebViewRegistry
fn clone(&self) -> WebViewRegistry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more