- From: Device APIs Working Group Issue Tracker <sysbot+tracker@w3.org>
- Date: Tue, 26 Aug 2014 15:05:21 +0000
- To: public-device-apis@w3.org
DAP-ISSUE-170: light levels are not retrievable until a change causes the devicelight event to fire. [Ambient Light Events API] http://www.w3.org/2009/dap/track/issues/170 Raised by: Frederick Hirsch On product: Ambient Light Events API on behalf of Anne Van Kesteren see http://lists.w3.org/Archives/Public/public-device-apis/2014Aug/0058.html Mozilla bug report (see URL for discussion thread) [[ The current event-based Ambient Light API has one limitation: light levels are not retrievable until a change causes the devicelight event to fire. Scenario: A newly loaded page wants to retrieve the ambient light levels. Expected result: The app can get the value from window.deviceLight or some such interface. Actual result: The app must wait until a devicelight event fires before receiving the light value. This could cause errant behavior on the part of the app, such as optimizing the interface for bright environments when it is actually dark. ]] Anne's message: 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.
Received on Tuesday, 26 August 2014 15:05:23 UTC