W3C home > Mailing lists > Public > public-device-apis-log@w3.org > December 2016

Re: [sensors] Don't allocate response objects to avoid triggering GC

From: Tobie Langel via GitHub <sysbot+gh@w3.org>
Date: Tue, 06 Dec 2016 15:30:00 +0000
To: public-device-apis-log@w3.org
Message-ID: <issue_comment.created-265179583-1481038198-sysbot+gh@w3.org>
> Although, this pattern will only work for singleton sensor types - 
there is only one gyro, and one accelerometer ever?
Does Sensors API assumes that there might be multiple sensors of the 
same type?
Lets say there are two controllers, like HTC Vive Controller, so you 
can have multiple attached. Does Sensors API covers this types of 
sensors too?

Yes, via [identifying 
parameters](https://w3c.github.io/sensors/#identifying-parameters) 
which are sensor type specific, e.g. (completely made-up identifying 
parameters):

```js
let gyro = new Gyroscope({
    frequency: 240,
    external: true, // identifying parameter
    hand: "right"   // identifying parameter
});
```
> One slight concern, with sensors that have frequency that affects 
the "accumulated" data. For example accelerometer would not just get 
current state, but accumulated between pulls data? If that is the 
case, then with sync use cases, pulling could be sync too.

I've punted on dealing with accumulate date for now, tbh. I wan't to 
make sure we don't design something that makes this impossible in the 
future, however, so suggestions are welcome.

-- 
GitHub Notification of comment by tobie
Please view or discuss this issue at 
https://github.com/w3c/sensors/issues/153#issuecomment-265179583 using
 your GitHub account
Received on Tuesday, 6 December 2016 15:41:56 UTC

This archive was generated by hypermail 2.3.1 : Monday, 23 October 2017 12:18:52 UTC