Describe the bug
Calling any unlisten() function returned by a listen() call remove all callbacks registered through listen().
To Reproduce
Steps to reproduce the behavior:
- Create a new tauri project (or use an existing one)
- Add the following code:
import { listen } from "@tauri-apps/api/event";
async function setup() {
let unlisten = await listen("tauri://blur", () => console.log("blur"));
await listen("tauri://focus", () => console.log("focus"));;
await listen("tauri://resize", () => console.log("resize"));;
unlisten();
}
setup();
- Open a console
- Resize/focus/blur the window
- Observe none of the callbacks are triggered
Expected behavior
Only the callback associated with the unlisten() function should be unregistered.
Platform and Versions (required):
Operating System - Arch Linux, version Rolling Release X64
Node.js environment
Node.js - 16.5.0
@tauri-apps/cli - 1.0.0-beta.6
@tauri-apps/api - 1.0.0-beta.5
Global packages
npm - 7.17.0
yarn - 1.22.10
Rust environment
rustc - 1.53.0
cargo - 1.53.0
App directory structure
/node_modules
/src
/src-tauri
/.git
App
tauri.rs - 1.0.0-beta.5
build-type - bundle
CSP - default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'
distDir - ../dist
devPath - http://localhost:3000
Describe the bug
Calling any
unlisten()function returned by alisten()call remove all callbacks registered throughlisten().To Reproduce
Steps to reproduce the behavior:
Expected behavior
Only the callback associated with the
unlisten()function should be unregistered.Platform and Versions (required):