pub trait Manager<R: Runtime>: ManagerBase<R> {
Show 16 methods
fn config(&self) -> Arc<Config> { ... }
fn emit_all<S: Serialize + Clone>(
&self,
event: &str,
payload: S
) -> Result<()> { ... }
fn emit_to<S: Serialize + Clone>(
&self,
label: &str,
event: &str,
payload: S
) -> Result<()> { ... }
fn listen_global<F>(
&self,
event: impl Into<String>,
handler: F
) -> EventHandler
where
F: Fn(Event) + Send + 'static,
{ ... }
fn once_global<F>(
&self,
event: impl Into<String>,
handler: F
) -> EventHandler
where
F: FnOnce(Event) + Send + 'static,
{ ... }
fn trigger_global(&self, event: &str, data: Option<String>) { ... }
fn unlisten(&self, handler_id: EventHandler) { ... }
fn get_window(&self, label: &str) -> Option<Window<R>> { ... }
fn windows(&self) -> HashMap<String, Window<R>> { ... }
fn manage<T>(&self, state: T)
where
T: Send + Sync + 'static,
{ ... }
fn state<T>(&self) -> State<'_, T>
where
T: Send + Sync + 'static,
{ ... }
fn try_state<T>(&self) -> Option<State<'_, T>>
where
T: Send + Sync + 'static,
{ ... }
fn env(&self) -> Env { ... }
fn fs_scope(&self) -> FsScope { ... }
fn asset_protocol_scope(&self) -> FsScope { ... }
fn shell_scope(&self) -> ShellScope { ... }
}
Expand description
Manages a running application.
Provided methods
Emits a event to all windows.
Emits an event to a window with the specified label.
fn listen_global<F>(&self, event: impl Into<String>, handler: F) -> EventHandler where
F: Fn(Event) + Send + 'static,
fn listen_global<F>(&self, event: impl Into<String>, handler: F) -> EventHandler where
F: Fn(Event) + Send + 'static,
Listen to a global event.
fn once_global<F>(&self, event: impl Into<String>, handler: F) -> EventHandler where
F: FnOnce(Event) + Send + 'static,
fn once_global<F>(&self, event: impl Into<String>, handler: F) -> EventHandler where
F: FnOnce(Event) + Send + 'static,
Listen to a global event only once.
fn trigger_global(&self, event: &str, data: Option<String>)
fn trigger_global(&self, event: &str, data: Option<String>)
Trigger a global event.
fn unlisten(&self, handler_id: EventHandler)
fn unlisten(&self, handler_id: EventHandler)
Remove an event listener.
fn get_window(&self, label: &str) -> Option<Window<R>>
fn get_window(&self, label: &str) -> Option<Window<R>>
Fetch a single window from the manager.
Add state
to the state managed by the application.
See crate::Builder
for instructions.
Gets the managed state for the type T
. Panics if the type is not managed.
Tries to get the managed state for the type T
. Returns None
if the type is not managed.
fn asset_protocol_scope(&self) -> FsScope
fn asset_protocol_scope(&self) -> FsScope
Gets the scope for the asset protocol.
fn shell_scope(&self) -> ShellScope
fn shell_scope(&self) -> ShellScope
Gets the scope for the shell execute APIs.