domenic has just created a new issue for https://github.com/w3c/wake-lock: == Consider using the platform's standard cancelation primitive, AbortSignal == Instead of a bespoke cancelable-request primitive with `WakeLockRequest`, instead use the `AbortSignal` primitive: ```js const signal = new AbortSignal(); wakeLock.createRequest({ signal }); // ... later ... signal.abort(); ``` Although this may seem like slightly more typing, it has benefits of not inventing a bespoke new cancelation framework for people to learn, and also allows integration with other cancelable things on the platform. For example, a common pattern we're starting to see is that people want to cancel a bunch of things at once, using a single abort signal. Something like: ```js const signal = new AbortSignal(); (await navigator.getWakeLock("screen")).createRequest({ signal }); (await navigator.getWakeLock("system")).createRequest({ signal }); const res = await fetch("https://example.com/", { signal }); // ... cancelButton.onclick = () => signal.abort(); ``` Please view or discuss this issue at https://github.com/w3c/wake-lock/issues/142 using your GitHub accountReceived on Thursday, 20 December 2018 19:48:41 UTC
This archive was generated by hypermail 2.4.0 : Monday, 4 July 2022 12:47:56 UTC