Expand description
A handle to the currently running application.
This type implements Manager
which allows for manipulation of global application items.
Implementations
sourceimpl AppHandle<Wry>
impl AppHandle<Wry>
sourcepub fn create_tao_window<F: FnOnce() -> (String, WryWindowBuilder) + Send + 'static>(
&self,
f: F
) -> Result<Weak<Window>>
pub fn create_tao_window<F: FnOnce() -> (String, WryWindowBuilder) + Send + 'static>(
&self,
f: F
) -> Result<Weak<Window>>
Create a new tao window using a callback. The event loop must be running at this point.
sourcepub fn send_tao_window_event(
&self,
window_id: WindowId,
message: WindowMessage
) -> Result<()>
pub fn send_tao_window_event(
&self,
window_id: WindowId,
message: WindowMessage
) -> Result<()>
Sends a window message to the event loop.
sourceimpl<R: Runtime> AppHandle<R>
impl<R: Runtime> AppHandle<R>
sourcepub fn create_window<F>(
&self,
label: impl Into<String>,
url: WindowUrl,
setup: F
) -> Result<Window<R>> where
F: FnOnce(<R::Dispatcher as Dispatch>::WindowBuilder, WebviewAttributes) -> (<R::Dispatcher as Dispatch>::WindowBuilder, WebviewAttributes),
pub fn create_window<F>(
&self,
label: impl Into<String>,
url: WindowUrl,
setup: F
) -> Result<Window<R>> where
F: FnOnce(<R::Dispatcher as Dispatch>::WindowBuilder, WebviewAttributes) -> (<R::Dispatcher as Dispatch>::WindowBuilder, WebviewAttributes),
Creates a new webview window.
Data URLs are only supported with the window-data-url
feature flag.
sourcepub fn tray_handle(&self) -> SystemTrayHandle<R>
This is supported on crate feature system-tray
only.
pub fn tray_handle(&self) -> SystemTrayHandle<R>
system-tray
only.Gets a handle handle to the system tray.
sourcepub fn path_resolver(&self) -> PathResolver
pub fn path_resolver(&self) -> PathResolver
The path resolver for the application.
sourcepub fn global_shortcut_manager(&self) -> R::GlobalShortcutManager
pub fn global_shortcut_manager(&self) -> R::GlobalShortcutManager
Gets a copy of the global shortcut manager instance.
sourcepub fn clipboard_manager(&self) -> R::ClipboardManager
pub fn clipboard_manager(&self) -> R::ClipboardManager
Gets a copy of the clipboard manager instance.
sourcepub fn config(&self) -> Arc<Config>
pub fn config(&self) -> Arc<Config>
Gets the app’s configuration, defined on the tauri.conf.json
file.
sourcepub fn package_info(&self) -> &PackageInfo
pub fn package_info(&self) -> &PackageInfo
Gets the app’s package information.
sourcepub fn asset_resolver(&self) -> AssetResolver<R>
pub fn asset_resolver(&self) -> AssetResolver<R>
The application’s asset resolver.
Trait Implementations
sourceimpl<'de, R: Runtime> CommandArg<'de, R> for AppHandle<R>
impl<'de, R: Runtime> CommandArg<'de, R> for AppHandle<R>
sourcefn from_command(command: CommandItem<'de, R>) -> Result<Self, InvokeError>
fn from_command(command: CommandItem<'de, R>) -> Result<Self, InvokeError>
Grabs the Window
from the CommandItem
and returns the associated AppHandle
. This will never fail.
sourceimpl<R: Debug + Runtime> Debug for AppHandle<R> where
R::Handle: Debug,
R::GlobalShortcutManager: Debug,
R::ClipboardManager: Debug,
impl<R: Debug + Runtime> Debug for AppHandle<R> where
R::Handle: Debug,
R::GlobalShortcutManager: Debug,
R::ClipboardManager: Debug,
sourceimpl<R: Runtime> Manager<R> for AppHandle<R>
impl<R: Runtime> Manager<R> for AppHandle<R>
sourcefn emit_all<S: Serialize + Clone>(&self, event: &str, payload: S) -> Result<()>
fn emit_all<S: Serialize + Clone>(&self, event: &str, payload: S) -> Result<()>
Emits a event to all windows.
sourcefn emit_to<S: Serialize + Clone>(
&self,
label: &str,
event: &str,
payload: S
) -> Result<()>
fn emit_to<S: Serialize + Clone>(
&self,
label: &str,
event: &str,
payload: S
) -> Result<()>
Emits an event to a window with the specified label.
sourcefn 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.
sourcefn 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.
sourcefn trigger_global(&self, event: &str, data: Option<String>)
fn trigger_global(&self, event: &str, data: Option<String>)
Trigger a global event.
sourcefn unlisten(&self, handler_id: EventHandler)
fn unlisten(&self, handler_id: EventHandler)
Remove an event listener.
sourcefn get_window(&self, label: &str) -> Option<Window<R>>
fn get_window(&self, label: &str) -> Option<Window<R>>
Fetch a single window from the manager.
sourcefn manage<T>(&self, state: T) where
T: Send + Sync + 'static,
fn manage<T>(&self, state: T) where
T: Send + Sync + 'static,
Add state
to the state managed by the application.
See crate::Builder
for instructions. Read more
sourcefn state<T>(&self) -> State<'_, T> where
T: Send + Sync + 'static,
fn state<T>(&self) -> State<'_, T> where
T: Send + Sync + 'static,
Gets the managed state for the type T
. Panics if the type is not managed.
sourcefn try_state<T>(&self) -> Option<State<'_, T>> where
T: Send + Sync + 'static,
fn try_state<T>(&self) -> Option<State<'_, T>> where
T: Send + Sync + 'static,
Tries to get the managed state for the type T
. Returns None
if the type is not managed.
sourcefn asset_protocol_scope(&self) -> FsScope
fn asset_protocol_scope(&self) -> FsScope
Gets the scope for the asset protocol.
sourcefn shell_scope(&self) -> ShellScope
fn shell_scope(&self) -> ShellScope
Gets the scope for the shell execute APIs.
Auto Trait Implementations
impl<R = Wry> !RefUnwindSafe for AppHandle<R>
impl<R> Send for AppHandle<R>
impl<R> Sync for AppHandle<R> where
<R as Runtime>::ClipboardManager: Sync,
<R as Runtime>::GlobalShortcutManager: Sync,
<R as Runtime>::Handle: Sync,
<R as Runtime>::TrayHandler: Sync,
impl<R> Unpin for AppHandle<R> where
<R as Runtime>::ClipboardManager: Unpin,
<R as Runtime>::GlobalShortcutManager: Unpin,
<R as Runtime>::Handle: Unpin,
<R as Runtime>::TrayHandler: Unpin,
impl<R = Wry> !UnwindSafe for AppHandle<R>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more