Ambient light API redesign

In https://bugzilla.mozilla.org/show_bug.cgi?id=1057185 we discovered
that the current API for  ambient lights is lacking and would require
hacks to addEventListener() to salvage. Since the API is not widely
adopted (only by Firefox per caniuse) we'd rather come up with a
better solution. Perhaps even establishing a pattern for how we should
expose hardware sensors to the web.

Perhaps something like this:

  var as = new AmbientSensor()
  var currentVal = await as.value
  as.onvaluechange = ...

as long as you have a reference to the object or the object has a
listener attached it cannot be GC'd.


-- 
http://annevankesteren.nl/

Received on Tuesday, 26 August 2014 09:43:46 UTC