- From: Olli Pettay <olli@pettay.fi>
- Date: Mon, 08 Sep 2014 15:10:47 +0300
- To: Tobie Langel <tobie.langel@gmail.com>
- CC: Mounir Lamouri <mounir@lamouri.fr>, Rick Waldron <waldron.rick@gmail.com>, Tim Volodine <timvolodine@google.com>, Marcos Caceres <marcos@marcosc.com>, Jonas Sicking <jonas@sicking.cc>, "public-device-apis@w3.org" <public-device-apis@w3.org>, Anssi Kostiainen <anssi.kostiainen@intel.com>, public-script-coord <public-script-coord@w3.org>, Doug Turner <dougt@mozilla.com>, Domenic Denicola <domenic@domenicdenicola.com>, Anne van Kesteren <annevk@annevk.nl>
On 09/08/2014 03:00 PM, Tobie Langel wrote: > > > > On Mon, Sep 8, 2014 at 1:53 PM, Olli Pettay <olli@pettay.fi <mailto:olli@pettay.fi>> wrote: > > On 09/08/2014 02:48 PM, Tobie Langel wrote: > > On Mon, Sep 8, 2014 at 1:38 PM, Mounir Lamouri <mounir@lamouri.fr <mailto:mounir@lamouri.fr> <mailto:mounir@lamouri.fr > <mailto:mounir@lamouri.fr>>> wrote: > > On Mon, 8 Sep 2014, at 21:24, Tobie Langel wrote: > > Given the requestAnimationFrame use cases exposed by Rick, it seems that > > obtaining the Sensor instance immediately is more developer friendly than > > getting it through a resolved promise. Especially if numerous sensors > > need > > to interact. > > ``` > sensors = null; > Promise.all(getSensor1(), getSensor2(), getSensor3()).then(function (s) > { > sensors = s; > }); > > requestAnimationFrame(__function(frame) { > requestAnimationFrame(frame); > > if (!sensors) > return; > > [...] > }); > ``` > > > This prevents displaying any data until all sensors have been provided with an initial value, which is probably not the kind of behavior you want. > > --tobie > > > That depends on how we eventually spec Promise should work in browsers. Wasn't the plan at some point to use microtasks? > (One of the main goals behind microtasks was to get callbacks to be called asynchronously, but asap, so in practice before rAF callbacks) > > > That's not what I was getting at. Image any of these promises above get rejected (e.g. disconnected temp sensor, access not granted by user or what > not). Nothing will be displayed. Similarly, if one of these sensors trigger a user prompt, none of the other's data will be accessible until the user > grants access to it. > > --tobie I see. If permission is required for many sensors, there sure should be some way to request permission only once.
Received on Monday, 8 September 2014 12:11:22 UTC