Trait tauri_runtime::Runtime

source ·
pub trait Runtime<T: UserEvent>:
    Debug
    + Sized
    + 'static {
    type Dispatcher: Dispatch<T, Runtime = Self>;
    type Handle: RuntimeHandle<T, Runtime = Self>;
    type GlobalShortcutManager: GlobalShortcutManager;
    type ClipboardManager: ClipboardManager;
    type TrayHandler: TrayHandle;
    type EventLoopProxy: EventLoopProxy<T>;

    // Required methods
    fn new() -> Result<Self>;
    fn new_any_thread() -> Result<Self>;
    fn create_proxy(&self) -> Self::EventLoopProxy;
    fn handle(&self) -> Self::Handle;
    fn global_shortcut_manager(&self) -> Self::GlobalShortcutManager;
    fn clipboard_manager(&self) -> Self::ClipboardManager;
    fn create_window(
        &self,
        pending: PendingWindow<T, Self>,
    ) -> Result<DetachedWindow<T, Self>>;
    fn system_tray(&self, system_tray: SystemTray) -> Result<Self::TrayHandler>;
    fn on_system_tray_event<F: Fn(TrayId, &SystemTrayEvent) + Send + 'static>(
        &mut self,
        f: F,
    );
    fn set_device_event_filter(&mut self, filter: DeviceEventFilter);
    fn run_iteration<F: Fn(RunEvent<T>) + 'static>(
        &mut self,
        callback: F,
    ) -> RunIteration;
    fn run<F: FnMut(RunEvent<T>) + 'static>(self, callback: F);
}
Expand description

The webview runtime interface.

Required Associated Types§

source

type Dispatcher: Dispatch<T, Runtime = Self>

The message dispatcher.

source

type Handle: RuntimeHandle<T, Runtime = Self>

The runtime handle type.

source

type GlobalShortcutManager: GlobalShortcutManager

The global shortcut manager type.

source

type ClipboardManager: ClipboardManager

The clipboard manager type.

source

type TrayHandler: TrayHandle

The tray handler type.

source

type EventLoopProxy: EventLoopProxy<T>

The proxy type.

Required Methods§

source

fn new() -> Result<Self>

Creates a new webview runtime. Must be used on the main thread.

source

fn new_any_thread() -> Result<Self>

Available on Windows or Linux only.

Creates a new webview runtime on any thread.

source

fn create_proxy(&self) -> Self::EventLoopProxy

Creates an EventLoopProxy that can be used to dispatch user events to the main event loop.

source

fn handle(&self) -> Self::Handle

Gets a runtime handle.

source

fn global_shortcut_manager(&self) -> Self::GlobalShortcutManager

Gets the global shortcut manager.

source

fn clipboard_manager(&self) -> Self::ClipboardManager

Gets the clipboard manager.

source

fn create_window( &self, pending: PendingWindow<T, Self>, ) -> Result<DetachedWindow<T, Self>>

Create a new webview window.

source

fn system_tray(&self, system_tray: SystemTray) -> Result<Self::TrayHandler>

Available on crate feature system-tray only.

Adds the icon to the system tray with the specified menu items.

source

fn on_system_tray_event<F: Fn(TrayId, &SystemTrayEvent) + Send + 'static>( &mut self, f: F, )

Available on crate feature system-tray only.

Registers a system tray event handler.

source

fn set_device_event_filter(&mut self, filter: DeviceEventFilter)

Change the device event filter mode.

Since the DeviceEvent capture can lead to high CPU usage for unfocused windows, tao will ignore them by default for unfocused windows on Windows. This method allows changing the filter to explicitly capture them again.

§Platform-specific
  • ** Linux / macOS / iOS / Android**: Unsupported.
source

fn run_iteration<F: Fn(RunEvent<T>) + 'static>( &mut self, callback: F, ) -> RunIteration

Runs the one step of the webview runtime event loop and returns control flow to the caller.

source

fn run<F: FnMut(RunEvent<T>) + 'static>(self, callback: F)

Run the webview runtime.

Object Safety§

This trait is not object safe.

Implementors§