W3C home > Mailing lists > Public > public-device-apis-log@w3.org > February 2018

[sensors] Clarify construction of subclasses

From: Anssi Kostiainen via GitHub <sysbot+gh@w3.org>
Date: Mon, 12 Feb 2018 14:17:52 +0000
To: public-device-apis-log@w3.org
Message-ID: <issues.opened-296389572-1518445071-sysbot+gh@w3.org>
anssiko has just created a new issue for https://github.com/w3c/sensors:

== Clarify construction of subclasses ==
I'll take an example of the Gyroscope spec, but the same applies to other concrete specs too.

 We state in the [model](https://w3c.github.io/gyroscope/#model) of the Gyroscope spec:

>The Gyroscope sensor type’s associated `Sensor` subclass is the `Gyroscope` class.

The first time we bind the sensor type to the constructed object in spec prose is when we hit [Connect to sensor](https://w3c.github.io/sensors/#connect-to-sensor) in [`start()`](https://w3c.github.io/sensors/#ref-for-connect-to-sensor) as follows:

>Let type be the sensor type of sensor_instance.

Here's an example to illustrate:
```
let gyro = new Gyroscope();
console.log(gyro instanceof Gyroscope); // true
console.log(gyro instanceof Sensor);    // true
```

Both the log statements should obviously return true, but from reading the spec, it is not so obvious the former log statement returns true before `start()` has been invoked.

Maybe we can do some tweaks to clarify this.

Please view or discuss this issue at https://github.com/w3c/sensors/issues/342 using your GitHub account
Received on Monday, 12 February 2018 14:17:56 UTC

This archive was generated by hypermail 2.4.0 : Monday, 4 July 2022 12:47:55 UTC