sensors icon indicating copy to clipboard operation
sensors copied to clipboard

getAll()?

Open rwaldron opened this issue 10 years ago • 4 comments
trafficstars

Why is this preferred over list()?

rwaldron avatar Jun 08 '15 22:06 rwaldron

For consistency, see the last part of my comment here: https://github.com/w3c/sensors/issues/26#issuecomment-109931182

tobie avatar Jun 08 '15 22:06 tobie

I've been getting ERR_CONNECTION_TIMED_OUT for two of those links for about an hour.

  • https://url.spec.whatwg.org/#dom-urlsearchparams-getallname
  • https://fetch.spec.whatwg.org/#dom-headers-getall

From the Headers#getAll docs on MDN, it appears that the Headers class produces a Map-like (multi-Map-like?) object:

  • getAll is method of the instance, not a static class method.
  • getAll is a synchronous operation

URLSearchParams appears to be the same design?

I don't agree that Sensor has any consistency obligation here.

rwaldron avatar Jun 09 '15 16:06 rwaldron

I've been getting ERR_CONNECTION_TIMED_OUT for two of those links for about an hour.

Weird. They seem to WFM.

getAll is method of the instance, not a static class method.

Right. But depending on the outcome of #28 and some possible design around that, Sensor.getAll() could very well end up as an instance method exposed on the sensors attribute of the Global object (just a thought). See, for example, the Clients interface in ServiceWorkers.

That said, I don't think it's worth looking too closely at the details right now, at least not until we solidify the overall architecture.

I don't agree that Sensor has any consistency obligation here.

I don't like to look at consistency as an obligations, but as weight you put in the balance when designing APIs. Something that's voluntarily inconsistant with other parts of the platform better have good reasons to be so.

tobie avatar Jun 09 '15 17:06 tobie

I agree those are the wrong examples. Clients and Notification might be more likely?

domenic avatar Jun 09 '15 17:06 domenic