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

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

From: Tobie Langel via GitHub <sysbot+gh@w3.org>
Date: Mon, 08 Jun 2015 16:35:19 +0000
To: public-device-apis@w3.org
Message-ID: <issue_comment.created-110067549-1433781318-sysbot+gh@w3.org>
> 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

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