W3C home > Mailing lists > Public > public-device-apis-log@w3.org > January 2017

Re: [sensors] DOMExceptions when calling stop/start on already stopped/started sensor

From: Kenneth Rohde Christiansen via GitHub <sysbot+gh@w3.org>
Date: Thu, 26 Jan 2017 20:30:57 +0000
To: public-device-apis-log@w3.org
Message-ID: <issue_comment.created-275504694-1485462655-sysbot+gh@w3.org>
I hate the current way it is working, especially if you deal with 
multiple sensors which you want to start and stop. Also having to 
check if it is one of two different states before being able to stop 
is just bad :-)

In JS - unless in strict mode - minor mistakes are just ignored and 
don't throw.

Examples:
```
delete Object.prototype; // doesn't delete, just ignored
var obj1 = {};
Object.defineProperty(obj1, "x", { value: 42, writable: false });
obj1.x = 9; // ignored

// Assignment to a getter-only property
var obj2 = { get x() { return 17; } };
obj2.x = 5; // ignored
```
Stopping something which is already stopped (or starting something 
which is started) I don't even consider a mistake, most of the time 
you just want to ensure something is stopped and don't care if it 
already is (or you want to start something if it isn't started).

-- 
GitHub Notification of comment by kenchris
Please view or discuss this issue at 
https://github.com/w3c/sensors/issues/158#issuecomment-275504694 using
 your GitHub account
Received on Thursday, 26 January 2017 20:31:32 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:34:22 UTC