diff --git a/.changes/unlisten.md b/.changes/unlisten.md new file mode 100644 index 000000000000..d60cce4adc40 --- /dev/null +++ b/.changes/unlisten.md @@ -0,0 +1,5 @@ +--- +"tauri": patch +--- + +Adds `unlisten` function to the `Window` struct. diff --git a/core/tauri/src/window.rs b/core/tauri/src/window.rs index bf023020ac03..d0113301e068 100644 --- a/core/tauri/src/window.rs +++ b/core/tauri/src/window.rs @@ -271,6 +271,11 @@ impl Window { self.manager.listen(event.into(), Some(label), handler) } + /// Unlisten to an event on this window. + pub fn unlisten(&self, handler_id: EventHandler) { + self.manager.unlisten(handler_id) + } + /// Listen to a an event on this window a single time. pub fn once(&self, event: impl Into, handler: F) -> EventHandler where