W3C home > Mailing lists > Public > public-device-apis-log@w3.org > January 2017

Re: [wake-lock] The spec is unnecessarily strict in regard to promise handling

From: Marcos Cáceres via GitHub <sysbot+gh@w3.org>
Date: Mon, 30 Jan 2017 04:00:22 +0000
To: public-device-apis-log@w3.org
Message-ID: <issue_comment.created-275975815-1485748821-sysbot+gh@w3.org>
> So I suggest that the spec shouldn't dictate a particular promise 
management mechanism and only specify when the returned promise must 
be rejected or fulfilled, and with which object.

I agree, FWIW. It will be confusing for developers if they sometimes 
get a new promise and sometimes not, so we should explicitly annotate 
things appropriately with WebIDL `[NewObject]`. That way, it won't 
matter if the promise is a cache promise internally, as basically we 
can always just assume that basically this will happen:

```JS
// either cached, or even rejected, it doesn't matter... always new 
promise
return Promise.resolve(promise);  
```


-- 
GitHub Notification of comment by marcoscaceres
Please view or discuss this issue at 
https://github.com/w3c/wake-lock/issues/92#issuecomment-275975815 
using your GitHub account
Received on Monday, 30 January 2017 04:00:29 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:34:22 UTC