diff options
author | 2020-03-30 18:15:13 +0200 | |
---|---|---|
committer | 2020-03-30 18:15:13 +0200 | |
commit | 148a4dd469c0b8f5f84f895878a43543275dd7f0 (patch) | |
tree | 5912c147d89c9fd240f847c00f000fb3f647ef57 /web | |
parent | c4c5216e3b69d732b0518d510f95675a4ba7010b (diff) | |
download | iced-148a4dd469c0b8f5f84f895878a43543275dd7f0.tar.gz iced-148a4dd469c0b8f5f84f895878a43543275dd7f0.tar.bz2 iced-148a4dd469c0b8f5f84f895878a43543275dd7f0.zip |
Call `Runtime::enter` properly in `iced_web`
Diffstat (limited to 'web')
-rw-r--r-- | web/src/lib.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/web/src/lib.rs b/web/src/lib.rs index bc46c541..a0b39c4a 100644 --- a/web/src/lib.rs +++ b/web/src/lib.rs @@ -188,7 +188,7 @@ pub trait Application { sender.clone(), ); - let (app, command) = Self::new(flags); + let (app, command) = runtime.enter(|| Self::new(flags)); let mut title = app.title(); document.set_title(&title); @@ -205,8 +205,13 @@ pub trait Application { let vdom = dodrio::Vdom::new(&body, instance); let event_loop = receiver.for_each(move |message| { - let command = application.borrow_mut().update(message); - let subscription = application.borrow().subscription(); + let (command, subscription) = runtime.enter(|| { + let command = application.borrow_mut().update(message); + let subscription = application.borrow().subscription(); + + (command, subscription) + }); + let new_title = application.borrow().title(); runtime.spawn(command); |