wemo-client
wemo-client copied to clipboard
How to unsubscribe from discovery?
When calling wemoClient.discover
, how do I unsubscribe?
hmm, it currently isn't possible i could think of a couple of solution to solve this
- One would be to use AbortSignal/AbortController
- Another would be to return a stop function
const ctrl = new AbortController()
const {signal} = ctrl
wemoClientDiscover(cb, { signal })
const listener = wemoClientDiscover(cb)
listener.stop()
it would also be cool to do something like
for await (const device of wemoClientDiscover({ signal })) {
// ...
}