- From: Anssi Kostiainen via GitHub <sysbot+gh@w3.org>
- Date: Fri, 05 Feb 2016 13:31:04 +0000
- To: public-device-apis@w3.org
I'm personally in the school of being consistent with the existing
platform (aka pave the cowpaths) unless we have compelling reasons to
diverge from that.
So I would prefer omitting the constructor as proposed in
https://github.com/w3c/sensors/issues/19#issuecomment-103112229 and
throw a `TypeError` on `new Sensor()`.
That'd be probably what developers would expect, and better developer
experience. Consider e.g.:
```
new Audio();
// success
new Image();
// success
new HTMLMediaElement();
// Uncaught TypeError: Illegal constructor(…)
new HTMLElement();
// Uncaught TypeError: Illegal constructor(…)
```
```
[NamedConstructor=Audio(...)]
interface HTMLAudioElement : HTMLMediaElement {};
[NamedConstructor=Image(...)]
interface HTMLImageElement : HTMLElement {
};
interface HTMLMediaElement : HTMLElement {
};
```
--
GitHub Notification of comment by anssiko
Please view or discuss this issue at
https://github.com/w3c/sensors/issues/19#issuecomment-180358135 using
your GitHub account
Received on Friday, 5 February 2016 13:31:06 UTC