From 8b45d620d048c33febbead4480d9ef62f196c9e1 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Mon, 12 Aug 2024 05:50:22 +0200 Subject: Revert `window::close` producing a `window::Id` Instead, subscribing to `window::close_events` is preferable; since most use cases will want to react to the user closing a window as well. --- runtime/src/window.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'runtime') diff --git a/runtime/src/window.rs b/runtime/src/window.rs index 0d280f1f..cd27cdfe 100644 --- a/runtime/src/window.rs +++ b/runtime/src/window.rs @@ -24,7 +24,7 @@ pub enum Action { Open(Id, Settings, oneshot::Sender), /// Close the window and exits the application. - Close(Id, oneshot::Sender), + Close(Id), /// Gets the [`Id`] of the oldest window. GetOldest(oneshot::Sender>), @@ -230,8 +230,8 @@ pub fn open(settings: Settings) -> (Id, Task) { } /// Closes the window with `id`. -pub fn close(id: Id) -> Task { - task::oneshot(|channel| crate::Action::Window(Action::Close(id, channel))) +pub fn close(id: Id) -> Task { + task::effect(crate::Action::Window(Action::Close(id))) } /// Gets the window [`Id`] of the oldest window. -- cgit