Re: [wake-lock] Allow to abort a request using an aborted signal (#183)

I agree with @marcoscaceres that the design seems odd, but I've missed out on previous discussions, so maybe there's good reasons.

Being able to 'request' a lock that's already been requested seems weird.

`AbortController` is specifically designed so a third party can't abort the ongoing thing, only the person who started the thing. But that doesn't seem like the goal here. In which case, an `.abort()` method on the instance seems to fit better.

```js
const lock = await wakeLocks.request('screen');
// and later:
lock.release();

// To release all locks:
for (const lock of await wakeLocks.query({ type: 'screen' })) {
  lock.release();
}
```

I'm not sure why `.query` would ever return an inactive lock.

-- 
GitHub Notification of comment by jakearchibald
Please view or discuss this issue at https://github.com/w3c/wake-lock/pull/183#issuecomment-488038960 using your GitHub account

Received on Tuesday, 30 April 2019 17:19:18 UTC