Skip to content

Commit 90cee3f

Browse files
author
Raphael Kubo da Costa
committed
Do some editorial adjustments to the Sensor algorithms.
- Use Web IDL's definition conventions for methods and getters (whatwg/webidl#882): - Describe getters as "The attr getter steps are [...]". - Describe methods as "The myMethod(arg) method steps are [...]". - Refer to [=this=] as defined in Web IDL rather than a concept that was not defined anywhere. - Use [=this=] rather than the `sensor_instance` variable where possible, as the latter was not defined anywhere. - When invoking the "notify error" abstract operation, pass the arguments in the order expected by the operation.
1 parent a587d57 commit 90cee3f

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
@@ -1091,9 +1091,9 @@ with the internal slots described in the following table:
10911091

10921092
<div algorithm="is sensor activated">
10931093

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

1096-
1. If <strong>this</strong>.{{[[state]]}} is "activated",
1096+
1. If [=this=].{{[[state]]}} is "activated",
10971097
return true.
10981098
1. Otherwise, return false.
10991099
</div>
@@ -1102,32 +1102,32 @@ with the internal slots described in the following table:
11021102

11031103
<div algorithm="sensor has reading">
11041104

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

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

11121112
### Sensor.timestamp ### {#sensor-timestamp}
11131113

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

1118+
It represents a [=reading timestamp=].
11181119

11191120
### Sensor.start() ### {#sensor-start}
11201121

11211122
<div algorithm="to start a sensor">
11221123

1123-
The {{Sensor/start()}} method must run these steps:
1124+
The {{Sensor/start()}} method steps are:
11241125

1125-
1. Let |sensor_state| be the value of |sensor_instance|.{{[[state]]}}.
1126-
1. If |sensor_state| is either "activating"
1127-
or "activated", then return.
1128-
1. Set |sensor_instance|.{{[[state]]}} to "activating".
1126+
1. If [=this=].{{[[state]]}} is either "activating" or "activated", then
1127+
return.
1128+
1. Set [=this=].{{[[state]]}} to "activating".
11291129
1. Run these sub-steps [=in parallel=]:
1130-
1. let |connected| be the result of invoking [=connect to sensor=] with |sensor_instance|
1130+
1. Let |connected| be the result of invoking [=connect to sensor=] with [=this=]
11311131
as argument.
11321132
1. If |connected| is false, then
11331133
1. Let |e| be the result of [=created|creating=] a
@@ -1142,29 +1142,29 @@ and "timestamp" as arguments. It represents a [=reading timestamp=].
11421142
correctly diagnosing the reason for the rejection
11431143
and might lead to confusing instructions to the user,
11441144
but it is a tradeoff some User Agent might choose to make. -->
1145-
1. Queue a task to run [=notify error=] with |e| and |sensor_instance| as arguments.
1145+
1. Queue a task to run [=notify error=] with [=this=] and |e| as arguments.
11461146
1. Return.
11471147
1. Let |permission_state| be the result of invoking
1148-
[=request sensor access=] with |sensor_instance| as argument.
1148+
[=request sensor access=] with [=this=] as argument.
11491149
1. If |permission_state| is "granted",
1150-
1. Invoke [=activate a sensor object=] with |sensor_instance| as argument.
1150+
1. Invoke [=activate a sensor object=] with [=this=] as argument.
11511151
1. Otherwise, if |permission_state| is "denied",
1152-
1. let |e| be the result of [=created|creating=]
1152+
1. Let |e| be the result of [=created|creating=]
11531153
a "{{NotAllowedError!!exception}}" {{DOMException}}.
1154-
1. Queue a task to run [=notify error=] with |e| and |sensor_instance| as arguments.
1154+
1. Queue a task to run [=notify error=] with [=this=] and |e| as arguments.
11551155
</div>
11561156

11571157

11581158
### Sensor.stop() ### {#sensor-stop}
11591159

11601160
<div algorithm="to stop a sensor">
11611161

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

1164-
1. If |sensor_instance|.{{[[state]]}} is "idle", then return.
1165-
1. Set |sensor_instance|.{{[[state]]}} to "idle".
1164+
1. If [=this=].{{[[state]]}} is "idle", then return.
1165+
1. Set [=this=].{{[[state]]}} to "idle".
11661166
1. Run these sub-steps [=in parallel=]:
1167-
1. Invoke [=deactivate a sensor object=] with |sensor_instance| as argument.
1167+
1. Invoke [=deactivate a sensor object=] with [=this=] as argument.
11681168
</div>
11691169

11701170

@@ -1177,7 +1177,7 @@ to notify that new [=sensor reading|reading=] is available.
11771177
### Sensor.onactivate ### {#sensor-onactivate}
11781178

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

11821182

11831183
### Sensor.onerror ### {#sensor-onerror}
@@ -1231,7 +1231,9 @@ dictionary SensorErrorEventInit : EventInit {
12311231

12321232
### SensorErrorEvent.error ### {#sensor-error-event-error}
12331233

1234-
Gets the {{DOMException}} object passed to {{SensorErrorEventInit}}.
1234+
The {{SensorErrorEvent/error!!attribute}} getter steps are to return the value it was initialized to.
1235+
1236+
It represents the {{DOMException}} object passed to {{SensorErrorEventInit}}.
12351237

12361238
<h2 id="abstract-operations">Abstract Operations</h2>
12371239

@@ -1350,7 +1352,7 @@ Gets the {{DOMException}} object passed to {{SensorErrorEventInit}}.
13501352
1. Invoke [=deactivate a sensor object=] with |s| as argument.
13511353
1. Let |e| be the result of [=created|creating=]
13521354
a "{{NotAllowedError!!exception}}" {{DOMException}}.
1353-
1. Queue a task to run [=notify error=] with |e| and |s| as arguments.
1355+
1. Queue a task to run [=notify error=] with |s| and |e| as arguments.
13541356
</div>
13551357

13561358

0 commit comments

Comments
 (0)