Re: [sensors] Do we need a lightweight interface representing available sensors?

> Why should this be a full-fledged class (but, a non-constructible 
one) instead of just a normal JS object?

Err, I guess the answers to that are:
1. I'm lifting this off of the [ServiceWorker Client class][1], and
2. I omitted the constructor because I'm bad at IDL. :)

> It makes more sense to have a getAll() return a list of normal JS 
objects, from which you can use the identifiers to create new Sensor 
instances.

Absolutely. That's what I had in mind.

> The createObserver model is a step backwards---remember that 
createObserver itself must call some constructor, so why are you 
hiding that constructor from authors?

I wasn't planning on hiding the constructor. That was just a 
convenience method destined to prefill the arguments list of the 
constructor itself with the identifier (and/or position + direction 
data and/or full object).

[1]: 
https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#client

-- 
GitHub Notif of comment by tobie
See https://github.com/w3c/sensors/issues/28#issuecomment-110067549

Received on Monday, 8 June 2015 16:35:22 UTC