W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2014

Re: Ambient light API redesign

From: Mounir Lamouri <mounir@lamouri.fr>
Date: Mon, 08 Sep 2014 21:38:42 +1000
Message-Id: <1410176322.3933601.164889781.2856D5A7@webmail.messagingengine.com>
To: Tobie Langel <tobie.langel@gmail.com>
Cc: 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, 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 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;

  [...]
});
```

-- Mounir
Received on Monday, 8 September 2014 11:39:07 UTC

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