Skip to main content

Trait tauri::Manager

pub trait Manager<R: Runtime>: ManagerBase<R> {
    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(EmittedEvent) + Send + 'static,
    { ... }

    fn once_global<F>(
        &self, 
        event: impl Into<String>, 
        handler: F
    ) -> EventHandler
    where
        F: Fn(EmittedEvent) + 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,
    { ... }
}

Expand description

Manages a running application.

Provided methods#

fn config(&self) -> Arc<Config>[src]#

The Config the manager was created with.

fn emit_all<S: Serialize + Clone>(&self, event: &str, payload: S) -> Result<()>[src]#

Emits a event to all windows.

fn emit_to<S: Serialize + Clone>( &self, label: &str, event: &str, payload: S ) -> Result<()>[src]#

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(EmittedEvent) + Send + 'static,[src]#

Listen to a global event.

fn once_global<F>(&self, event: impl Into<String>, handler: F) -> EventHandler where F: Fn(EmittedEvent) + Send + 'static,[src]#

Listen to a global event only once.

fn trigger_global(&self, event: &str, data: Option<String>)[src]#

Trigger a global event.

fn unlisten(&self, handler_id: EventHandler)[src]#

Remove an event listener.

fn get_window(&self, label: &str) -> Option<Window<R>>[src]#

Fetch a single window from the manager.

fn windows(&self) -> HashMap<String, Window<R>>[src]#

Fetch all managed windows.

fn manage<T>(&self, state: T) where T: Send + Sync + 'static,[src]#

Add state to the state managed by the application. See crate::Builder for instructions.

fn state<T>(&self) -> State<'_, T> where T: Send + Sync + 'static,[src]#

Gets the managed state for the type T. Panics if the type is not managed.

fn try_state<T>(&self) -> Option<State<'_, T>> where T: Send + Sync + 'static,[src]#

Tries to get the managed state for the type T. Returns None if the type is not managed.

Implementors#

impl<R: Runtime> Manager<R> for App<R>#

[src]

impl<R: Runtime> Manager<R> for AppHandle<R>#

[src]

impl<R: Runtime> Manager<R> for Window<R>#

[src]