- From: Kenneth Rohde Christiansen via GitHub <sysbot+gh@w3.org>
- Date: Wed, 20 Sep 2017 08:12:59 +0000
- To: public-device-apis-log@w3.org
I still think that hasReading is clearer from JS point of view, when you do sensor fusion. I don't know whether you can do something smart with TS, but I will assume it will complain about this: ``` // @ts-check const gyro = new Gyroscope(); const accel = new Accelerometer(); gyro.start(); accel.start(); gyro.onreading = () => { let value = gyro.x; // this will be valid but TS will not know that and complain that I need to null check if (accel.hasReading) { // Accelerometer values might not be valid, might not be started at all; let otherValue = accel.x; // this will be valid but TS will complain that I need to null check } } ``` -- GitHub Notification of comment by kenchris Please view or discuss this issue at https://github.com/w3c/sensors/issues/269#issuecomment-330778719 using your GitHub account
Received on Wednesday, 20 September 2017 08:12:57 UTC