- From: Tobie Langel via GitHub <sysbot+gh@w3.org>
- Date: Thu, 26 Jan 2017 12:59:35 +0000
- To: public-device-apis-log@w3.org
>From a developer experience perspective, I don't think that's an
optimum solution, as now you have to figure out whether your option is
immutable or not.
Given extra options won't throw, developers won't even figure out
what's going on if they make a mistake here. For example, the below
would default to the implementation specific default, and finding out
about that would require inspecting the timestamps, storing and
comparing them.
```js
let gyro = new Gyroscope({ frequency: 60 });
gyro.start();
```
Similarly, in the following scenario, the developer might expect the
frequency set earlier to stick:
```js
let gyro = new Gyroscope();
gyro.start({ frequency: 60 });
gyro.stop();
gyro.start(); // what's the frequency here? 60 or DEFAULT?
```
For these reasons, I believe an option maybe based on exposing a
`frequency` attribute or a dedicated `.setFrequency(freq)` method
might be better. We should investigate it as part of level 2.
--
GitHub Notification of comment by tobie
Please view or discuss this issue at
https://github.com/w3c/sensors/issues/139#issuecomment-275382596 using
your GitHub account
Received on Thursday, 26 January 2017 12:59:40 UTC