Skip to content

Commit f9caadf

Browse files
authored
Merge pull request #425 from rakuco/algorithm-proof-reading
Do some editorial adjustments to the Sensor algorithms.
2 parents ef6a1e3 + 90cee3f commit f9caadf

File tree

1 file changed

+27
-25
lines changed

1 file changed

+27
-25
lines changed

index.bs

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,9 +1102,9 @@ with the internal slots described in the following table:
11021102

11031103
<div algorithm="is sensor activated">
11041104

1105-
The getter of the {{Sensor/activated!!attribute}} attribute must run these steps:
1105+
The {{Sensor/activated!!attribute}} getter steps are:
11061106

1107-
1. If <strong>this</strong>.{{[[state]]}} is "activated",
1107+
1. If [=this=].{{[[state]]}} is "activated",
11081108
return true.
11091109
1. Otherwise, return false.
11101110
</div>
@@ -1113,32 +1113,32 @@ with the internal slots described in the following table:
11131113

11141114
<div algorithm="sensor has reading">
11151115

1116-
The getter of the {{Sensor/hasReading!!attribute}} attribute must run these steps:
1116+
The {{Sensor/hasReading!!attribute}} getter steps are:
11171117

1118-
1. Let |timestamp| be the result of invoking [=get value from latest reading=] with <strong>this</strong> and "timestamp" as arguments.
1118+
1. Let |timestamp| be the result of invoking [=get value from latest reading=] with [=this=] and "timestamp" as arguments.
11191119
1. If |timestamp| is not null, return true.
11201120
1. Otherwise, return false.
11211121
</div>
11221122

11231123
### Sensor.timestamp ### {#sensor-timestamp}
11241124

1125-
The getter of the {{Sensor/timestamp!!attribute}} attribute returns
1126-
the result of invoking [=get value from latest reading=] with <strong>this</strong>
1127-
and "timestamp" as arguments. It represents a [=reading timestamp=].
1125+
The {{Sensor/timestamp!!attribute}} getter steps are to return
1126+
the result of invoking [=get value from latest reading=] with [=this=]
1127+
and "timestamp" as arguments.
11281128

1129+
It represents a [=reading timestamp=].
11291130

11301131
### Sensor.start() ### {#sensor-start}
11311132

11321133
<div algorithm="to start a sensor">
11331134

1134-
The {{Sensor/start()}} method must run these steps:
1135+
The {{Sensor/start()}} method steps are:
11351136

1136-
1. Let |sensor_state| be the value of |sensor_instance|.{{[[state]]}}.
1137-
1. If |sensor_state| is either "activating"
1138-
or "activated", then return.
1139-
1. Set |sensor_instance|.{{[[state]]}} to "activating".
1137+
1. If [=this=].{{[[state]]}} is either "activating" or "activated", then
1138+
return.
1139+
1. Set [=this=].{{[[state]]}} to "activating".
11401140
1. Run these sub-steps [=in parallel=]:
1141-
1. let |connected| be the result of invoking [=connect to sensor=] with |sensor_instance|
1141+
1. Let |connected| be the result of invoking [=connect to sensor=] with [=this=]
11421142
as argument.
11431143
1. If |connected| is false, then
11441144
1. Let |e| be the result of [=created|creating=] a
@@ -1153,29 +1153,29 @@ and "timestamp" as arguments. It represents a [=reading timestamp=].
11531153
correctly diagnosing the reason for the rejection
11541154
and might lead to confusing instructions to the user,
11551155
but it is a tradeoff some User Agent might choose to make. -->
1156-
1. Queue a task to run [=notify error=] with |e| and |sensor_instance| as arguments.
1156+
1. Queue a task to run [=notify error=] with [=this=] and |e| as arguments.
11571157
1. Return.
11581158
1. Let |permission_state| be the result of invoking
1159-
[=request sensor access=] with |sensor_instance| as argument.
1159+
[=request sensor access=] with [=this=] as argument.
11601160
1. If |permission_state| is "granted",
1161-
1. Invoke [=activate a sensor object=] with |sensor_instance| as argument.
1161+
1. Invoke [=activate a sensor object=] with [=this=] as argument.
11621162
1. Otherwise, if |permission_state| is "denied",
1163-
1. let |e| be the result of [=created|creating=]
1163+
1. Let |e| be the result of [=created|creating=]
11641164
a "{{NotAllowedError!!exception}}" {{DOMException}}.
1165-
1. Queue a task to run [=notify error=] with |e| and |sensor_instance| as arguments.
1165+
1. Queue a task to run [=notify error=] with [=this=] and |e| as arguments.
11661166
</div>
11671167

11681168

11691169
### Sensor.stop() ### {#sensor-stop}
11701170

11711171
<div algorithm="to stop a sensor">
11721172

1173-
The {{Sensor/stop()}} method must run these steps:
1173+
The {{Sensor/stop()}} method steps are:
11741174

1175-
1. If |sensor_instance|.{{[[state]]}} is "idle", then return.
1176-
1. Set |sensor_instance|.{{[[state]]}} to "idle".
1175+
1. If [=this=].{{[[state]]}} is "idle", then return.
1176+
1. Set [=this=].{{[[state]]}} to "idle".
11771177
1. Run these sub-steps [=in parallel=]:
1178-
1. Invoke [=deactivate a sensor object=] with |sensor_instance| as argument.
1178+
1. Invoke [=deactivate a sensor object=] with [=this=] as argument.
11791179
</div>
11801180

11811181

@@ -1188,7 +1188,7 @@ to notify that new [=sensor reading|reading=] is available.
11881188
### Sensor.onactivate ### {#sensor-onactivate}
11891189

11901190
{{Sensor/onactivate}} is an {{EventHandler}} which is called when
1191-
<strong>this</strong>.{{[[state]]}} transitions from "activating" to "activated".
1191+
[=this=].{{[[state]]}} transitions from "activating" to "activated".
11921192

11931193

11941194
### Sensor.onerror ### {#sensor-onerror}
@@ -1242,7 +1242,9 @@ dictionary SensorErrorEventInit : EventInit {
12421242

12431243
### SensorErrorEvent.error ### {#sensor-error-event-error}
12441244

1245-
Gets the {{DOMException}} object passed to {{SensorErrorEventInit}}.
1245+
The {{SensorErrorEvent/error!!attribute}} getter steps are to return the value it was initialized to.
1246+
1247+
It represents the {{DOMException}} object passed to {{SensorErrorEventInit}}.
12461248

12471249
<h2 id="abstract-operations">Abstract Operations</h2>
12481250

@@ -1361,7 +1363,7 @@ Gets the {{DOMException}} object passed to {{SensorErrorEventInit}}.
13611363
1. Invoke [=deactivate a sensor object=] with |s| as argument.
13621364
1. Let |e| be the result of [=created|creating=]
13631365
a "{{NotAllowedError!!exception}}" {{DOMException}}.
1364-
1. Queue a task to run [=notify error=] with |e| and |s| as arguments.
1366+
1. Queue a task to run [=notify error=] with |s| and |e| as arguments.
13651367
</div>
13661368

13671369

0 commit comments

Comments
 (0)