pub struct RuntimeContext<T: UserEvent> { /* private fields */ }
Implementations§
Source§impl<T: UserEvent> RuntimeContext<T>
impl<T: UserEvent> RuntimeContext<T>
pub fn send_message(&self, message: Message<T>) -> Result<()>
Sourcepub fn run_on_main_thread<F: FnOnce() + Send + 'static>(
&self,
f: F,
) -> Result<()>
pub fn run_on_main_thread<F: FnOnce() + Send + 'static>( &self, f: F, ) -> Result<()>
Run a task on the main thread.
Sourcepub fn run_on_main_thread_with_event_loop<X: Send + Sync + 'static, F: FnOnce(&TaoEventLoopWindowTarget<Message<T>>) -> X + Send + 'static>(
&self,
f: F,
) -> Result<X>
pub fn run_on_main_thread_with_event_loop<X: Send + Sync + 'static, F: FnOnce(&TaoEventLoopWindowTarget<Message<T>>) -> X + Send + 'static>( &self, f: F, ) -> Result<X>
Run a task on the main thread.
pub fn next_window_id(&self) -> WindowId
pub fn next_webview_id(&self) -> u32
pub fn next_window_event_id(&self) -> WindowEventId
pub fn next_webview_event_id(&self) -> WindowEventId
Sourcepub fn create_window<R: Runtime<T, WindowDispatcher = VersoWindowDispatcher<T>, WebviewDispatcher = VersoWebviewDispatcher<T>>, F: Fn(RawWindow<'_>) + Send + 'static>(
&self,
pending: PendingWindow<T, R>,
_after_window_creation: Option<F>,
) -> Result<DetachedWindow<T, R>>
pub fn create_window<R: Runtime<T, WindowDispatcher = VersoWindowDispatcher<T>, WebviewDispatcher = VersoWebviewDispatcher<T>>, F: Fn(RawWindow<'_>) + Send + 'static>( &self, pending: PendingWindow<T, R>, _after_window_creation: Option<F>, ) -> Result<DetachedWindow<T, R>>
after_window_creation
not supported
Only creating the window with a webview is supported,
will return [tauri_runtime::Error::CreateWindow
] if there is no [PendingWindow::webview
]
Sourcepub fn handle_close_window_request<F: FnMut(RunEvent<T>) + 'static>(
&self,
callback: &mut F,
id: WindowId,
force: bool,
) -> bool
pub fn handle_close_window_request<F: FnMut(RunEvent<T>) + 'static>( &self, callback: &mut F, id: WindowId, force: bool, ) -> bool
Handles the close window request by sending the [WindowEvent::CloseRequested
] event
if the request doesn’t request a forced close
and if not prevented, send [WindowEvent::Destroyed
]
then checks if there’re windows left, if not, send [RunEvent::ExitRequested
]
returns if we should exit the event loop
Trait Implementations§
Source§impl<T: Clone + UserEvent> Clone for RuntimeContext<T>
impl<T: Clone + UserEvent> Clone for RuntimeContext<T>
Source§fn clone(&self) -> RuntimeContext<T>
fn clone(&self) -> RuntimeContext<T>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl<T> Freeze for RuntimeContext<T>
impl<T> RefUnwindSafe for RuntimeContext<T>
impl<T> Send for RuntimeContext<T>
impl<T> Sync for RuntimeContext<T>
impl<T> Unpin for RuntimeContext<T>where
T: Unpin,
impl<T> UnwindSafe for RuntimeContext<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more