From fd593f8fb0c8476463f9c04ae2bcc96784b8c530 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 30 Jul 2024 22:26:55 +0200 Subject: Return `window::Id` in `window::open` --- runtime/src/window.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'runtime') diff --git a/runtime/src/window.rs b/runtime/src/window.rs index ee03f84f..cd27cdfe 100644 --- a/runtime/src/window.rs +++ b/runtime/src/window.rs @@ -218,12 +218,15 @@ pub fn close_requests() -> Subscription { /// Opens a new window with the given [`Settings`]; producing the [`Id`] /// of the new window on completion. -pub fn open(settings: Settings) -> Task { +pub fn open(settings: Settings) -> (Id, Task) { let id = Id::unique(); - task::oneshot(|channel| { - crate::Action::Window(Action::Open(id, settings, channel)) - }) + ( + id, + task::oneshot(|channel| { + crate::Action::Window(Action::Open(id, settings, channel)) + }), + ) } /// Closes the window with `id`. -- cgit