- From: Alexis Menard via GitHub <sysbot+gh@w3.org>
- Date: Thu, 26 Jan 2017 19:16:25 +0000
- To: public-device-apis-log@w3.org
darktears has just created a new issue for https://github.com/w3c/sensors: == DOMExceptions when calling stop/start on already stopped/started sensor == I was wondering if the DOMException is a bit overkill for what I mentioned in the title. Right now to avoid a pretty intrusive DOMException you need to do : `if (accelerometer.state != 'idle') accelerometer.stop();` Usually API like Qt, .NET doesn't do anything on stop() when the "object" is already stopped. Since there is no way in the Generic Sensor API to modify the Sensor Options after construction, there is nothing fundamentally wrong with calling start() on an already started sensor, it will just early return from an implementation POV. When you start using the GenericSensor in a more complicated code base you may end up in a fct where you want to stop the sensor polling from multiple callers, and you may not know the state of the sensor before hand so you have to do what the snippet is doing above. This require a string comparison for not much value IMHO. Please view or discuss this issue at https://github.com/w3c/sensors/issues/158 using your GitHub account
Received on Thursday, 26 January 2017 19:17:01 UTC