Skip to content

Commit

Permalink
Unlisten to an event on this window (#2664)
Browse files Browse the repository at this point in the history
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
  • Loading branch information
ThisSeanZhang and lucasfernog committed Sep 27, 2021
1 parent 4298c0c commit 3a59f5f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changes/unlisten.md
@@ -0,0 +1,5 @@
---
"tauri": patch
---

Adds `unlisten` function to the `Window` struct.
5 changes: 5 additions & 0 deletions core/tauri/src/window.rs
Expand Up @@ -271,6 +271,11 @@ impl<R: Runtime> Window<R> {
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<F>(&self, event: impl Into<String>, handler: F) -> EventHandler
where
Expand Down

0 comments on commit 3a59f5f

Please sign in to comment.