Skip to content

Commit

Permalink
Merge pull request #239 from pozdnyakov/onreading
Browse files Browse the repository at this point in the history
Rename 'onchange' to 'onreading'
  • Loading branch information
Mikhail Pozdnyakov authored Jun 28, 2017
2 parents eb9916f + 577bcda commit 1f30b92
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 51 deletions.
23 changes: 10 additions & 13 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ the default [=sensor=] is chosen.
<pre highlight="js">
let sensor = new GeolocationSensor({ accuracy: "high" });

sensor.onchange = function(event) {
sensor.onreading = function(event) {
var coords = [sensor.latitude, sensor.longitude];
updateMap(null, coords, sensor.accuracy);
};
Expand Down Expand Up @@ -189,7 +189,7 @@ define ways to uniquely identify each one.

<pre highlight="js">
var sensor = new DirectTirePressureSensor({ position: "rear", side: "left" });
sensor.onchange = _ => console.log(sensor.pressure);
sensor.onreading = _ => console.log(sensor.pressure);
sensor.start();
</pre>
</div>
Expand Down Expand Up @@ -260,7 +260,7 @@ and defensive programming which includes:
var sensor = new GeolocationSensor();
sensor.start();
sensor.onerror = error => gracefullyDegrade(error);
sensor.onchange = _ => updatePosition(sensor.latitude, sensor.longitude);
sensor.onreading = _ => updatePosition(sensor.latitude, sensor.longitude);
} catch(error) {
gracefullyDegrade(error);
}
Expand Down Expand Up @@ -741,7 +741,7 @@ interface Sensor : EventTarget {
readonly attribute DOMHighResTimeStamp? timestamp;
void start();
void stop();
attribute EventHandler onchange;
attribute EventHandler onreading;
attribute EventHandler onactivate;
attribute EventHandler onerror;
};
Expand Down Expand Up @@ -938,15 +938,12 @@ and "timestamp" as arguments.
</div>


### Sensor.onchange ### {#sensor-onchange}
### Sensor.onreading ### {#sensor-onreading}

{{Sensor/onchange}} is an {{EventHandler}} which is called
{{Sensor/onreading}} is an {{EventHandler}} which is called
to notify that new [=sensor reading|reading=] is available.


Issue(205):


### Sensor.onactivate ### {#sensor-onactivate}

{{Sensor/onactivate}} is an {{EventHandler}} which is called when
Expand Down Expand Up @@ -974,8 +971,8 @@ that must be supported as attributes by the objects implementing the {{Sensor}}
</thead>
<tbody>
<tr>
<td><strong><code>onchange</code></strong></td>
<td><code>change</code></td>
<td><strong><code>onreading</code></strong></td>
<td><code>reading</code></td>
</tr>
<tr>
<td><strong><code>onactivate</code></strong></td>
Expand Down Expand Up @@ -1284,7 +1281,7 @@ Gets the {{Error}} object passed to {{SensorErrorEventInit}}.
Issue: Should we fire delayed readings? Or should we just drop readings instead?

1. Set |sensor_instance|.{{[[waitingForUpdate]]}} to false.
1. [=Fire an event=] named "change" at |sensor_instance|.
1. [=Fire an event=] named "reading" at |sensor_instance|.
1. Set |sensor_instance|.{{[[lastEventFiredAt]]}} to |timestamp|.

Issue(215):
Expand Down Expand Up @@ -1389,7 +1386,7 @@ in order to reduce resource consumption, notably battery usage.

1. Set |sensor_instance|.{{[[waitingForUpdate]]}} to false.
1. Set |sensor_instance|.{{[[lastEventFiredAt]]}} to [=latest reading=]["timestamp"].
1. [=Fire an event=] named "change" at |sensor_instance|.
1. [=Fire an event=] named "reading" at |sensor_instance|.
</div>


Expand Down
Loading

0 comments on commit 1f30b92

Please sign in to comment.