W3C home > Mailing lists > Public > public-device-apis@w3.org > June 2015

Re: [sensors] Dependency on [DOM] due to inheriting from EventTarget

From: Tobie Langel via GitHub <sysbot+gh@w3.org>
Date: Thu, 11 Jun 2015 20:42:21 +0000
To: public-device-apis@w3.org
Message-ID: <issue_comment.created-111272750-1434055341-sysbot+gh@w3.org>
> Take the one-time location request example from the existing spec 
(where a fresh location is required) and show how the Sensor API 
applies. (Yes - I know this is not a Promise-based API, but it can be 
adapted to be Promise-based).

So I see three things which aren't immediately available here:

1. The ability to lookup a cached SensorReading without polling the 
sensor, that doesn't seem like a big issue, and could be added in 
either the Generic Sensor API itself or in the GeolocationSensor. 
Tracking it here #47.
2. The possibility to stop a `SensorObserver` before it is garbage 
collected. In practice I'm not sure that's really needed 
([Johnny-Five][1] doesn't seem to support it), nevertheless, filed an 
issue for it: #48.
3. A convenience method to get a single `SensorReading` through a 
Promise. This is actually both trivial to spec, implement and even 
polyfill. It had been provided in a previous iteration of the spec, 
removed in order to focus on solving lower-level primitives, but could
 be added back, either in the Generic Sensor Spec itself, or in the 
Geolocation spec. Tracking here: #49.

The Web developer community would benefit greatly from more 
consistency across the platform. So I sincerely hope we can resolve 
those issues and get the Geolocation Working Group fully onboard this 
effort.

FWIW, you'll note a the new design I'm suggesting in #46 borrows a lot
 of its aspect (notably the promise-based `Sensors.matchAll` sensor 
discovery method) from @timvolodine's [initial proposal][2]

> Note that there are no DOM dependencies in the example as far as I 
can tell.

No, but there's a dependency on navigator, thus on HTML, which 
frankly, is about as bad. ;)

[1]: https://github.com/rwaldron/johnny-five/wiki/Sensor
[2]: 
https://www.w3.org/2008/geolocation/wiki/images/6/69/TPAC-sensors.pdf

-- 
GitHub Notif of comment by tobie
See https://github.com/w3c/sensors/issues/21#issuecomment-111272750
Received on Thursday, 11 June 2015 20:42:23 UTC

This archive was generated by hypermail 2.3.1 : Monday, 23 October 2017 14:54:05 UTC