- From: Alexander Shalamov via GitHub <sysbot+gh@w3.org>
- Date: Tue, 15 Nov 2016 12:37:33 +0000
- To: public-device-apis-log@w3.org
> What about option 3bis:
I think we should not derive uncalibrated reading interface from
calibrated. This can produce unwanted side effects when developer
checks what kind of reading is provided by sensor.
Omited constructors and init dicts to shorten example:
```
interface Magnetometer : Sensor {
// Not needed, just to illustrate that the reading interface is
changed
// depending on the passed SensorOptions.
readonly attribute (MagnetometerReading or MagnetometerRawReading)
reading;
};
interface MagnetometerReading : SensorReading {
readonly attribute double x;
readonly attribute double y;
readonly attribute double z;
};
interface MagnetometerRawReading : SensorReading {
readonly attribute double x;
readonly attribute double y;
readonly attribute double z;
readonly attribute double xBias;
readonly attribute double yBias;
readonly attribute double zBias;
};
```
Therefore:
```
rawMagn.reading instanceof MagnetometerRawReading; // true
rawMagn.reading instanceof MagnetometerReading; // false
```
@tobie What do you think?
--
GitHub Notification of comment by alexshalamov
Please view or discuss this issue at
https://github.com/w3c/magnetometer/issues/16#issuecomment-260630242
using your GitHub account
Received on Tuesday, 15 November 2016 12:37:40 UTC