Skip to content

Is there some way for backend to emit event actively? #5111

Answered by FabianLars
Hellager asked this question in Q&A
Discussion options

You must be logged in to vote

The code at the bottom, the "origin code", looks correct to me in terms of AppHandle usage, and it can't really get stuck because of the AppHandle itself either. It's probably some kind of deadlock happening with the mutex or watcher 🤔

I did copy that bottom code snippet into my app and it didn't block anything.

And also here's how you could make it a little easier:

// handler.rs
// in this case, whether it's AppHandle or Window, the program will just stuck and not able to anything
pub struct MonitorHandler {
    pub watcher: Hotwatch,
    pub app_handler: Option<AppHandle>
}

impl MonitorHandler {
    pub fn initialize_app_handler(&mut self, handler: AppHandle) {
        self.app_handler = 

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Hellager
Comment options

Answer selected by Hellager
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants