const subs = []; const pending = []; /* Tauri's `listen` is an invoke like any other, so eight of them one behind the other is eight bridge round trips each waiting on the one before. They never depended on one another: all eight go out at once and the wait happens once, at the end. The ordering that does matter is kept — bindSlsk still does not return until every handler is registered, so connectStored() cannot let a fast `connected` land with nobody listening. */ const on = (name, fn) => { pending.push(listen(name, (ev) => fn(ev.payload)).then((u) => { subs.push(u); }, () => { /* not a phone */ })); }; on("soulseek:state", (ev) => {