Skip to content

Commit 3a59f5f

Browse files
Unlisten to an event on this window (#2664)
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
1 parent 4298c0c commit 3a59f5f

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

.changes/unlisten.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri": patch
3+
---
4+
5+
Adds `unlisten` function to the `Window` struct.

core/tauri/src/window.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,11 @@ impl<R: Runtime> Window<R> {
271271
self.manager.listen(event.into(), Some(label), handler)
272272
}
273273

274+
/// Unlisten to an event on this window.
275+
pub fn unlisten(&self, handler_id: EventHandler) {
276+
self.manager.unlisten(handler_id)
277+
}
278+
274279
/// Listen to a an event on this window a single time.
275280
pub fn once<F>(&self, event: impl Into<String>, handler: F) -> EventHandler
276281
where

0 commit comments

Comments
 (0)