Replies: 1 comment 1 reply
-
.setup(|app| {
let handle = app.handle();
let id = app.listen_global("update-battery", move |event| { // i think that this needs the move keyword, not sure right now
handle.tray_handle().get_item("battery").set_title("New title");
});
// app.unlisten(id); Don't unlisten here as it would make the listen_global call above useless (immediately unregistered)
Ok(())
}) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am writing my app's
setup
method to listen to a global event, where I am basically using the same approach described here:https://tauri.app/v1/guides/features/events#global-events-1
But I am getting a specific error about thread safety (full error below):
Here's the relevant part of my code:
Can you help me understand the difference between my implementation and the documentation mentioned above?
For reference, here's the full
main.rs
:And full backtrace:
Beta Was this translation helpful? Give feedback.
All reactions