Skip to content

Commit

Permalink
Merge 'unconnected' and 'errored' states into 'idle' (#179)
Browse files Browse the repository at this point in the history
Addresses #160.

States are now 'idle', 'activating', 'activated'.
  • Loading branch information
Mikhail Pozdnyakov authored and tobie committed Apr 4, 2017
1 parent 4a46009 commit b68e171
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -606,11 +606,9 @@ dictionary SensorOptions {
};

enum SensorState {
"unconnected",
"activating",
"activated",
"idle",
"errored"
"activating",
"activated"
};
</pre>

Expand Down Expand Up @@ -650,12 +648,10 @@ with the internal slots described in the following table:
<tr>
<td><dfn export>\[[state]]</dfn></td>
<td>The current state of {{Sensor}} object which is one of
<a enum-value>"unconnected"</a>,
<a enum-value>"idle"</a>,
<a enum-value>"activating"</a>,
<a enum-value>"activated"</a>,
<a enum-value>"idle"</a>, and
<a enum-value>"errored"</a>.
It is initially <a enum-value>"unconnected"</a>.
It is initially <a enum-value>"idle"</a>.
</td>
</tr>
<tr>
Expand Down Expand Up @@ -706,10 +702,9 @@ The {{Sensor/start()}} method must run these steps or their [=equivalent=]:
or <a enum-value>"activated"</a>, then return.
1. Set |sensor_instance|.[=[[state]]=] to <a enum-value>"activating"</a>.
1. Run these sub-steps [=in parallel=]:
1. If |sensor_state| is <a enum-value>"unconnected"</a>, then:
1. let |connected| be the result of invoking
the [=Connect to Sensor=] abstract operation.
1. If |connected| is `false`, then abort these steps.
1. let |connected| be the result of invoking
the [=Connect to Sensor=] abstract operation.
1. If |connected| is `false`, then abort these steps.
1. Let |permission_state| be the result of invoking
the [=Request Sensor Access=] abstract operation,
passing it |sensor_instance| as argument.
Expand Down Expand Up @@ -822,7 +817,7 @@ Gets the {{Error}} object passed to {{SensorErrorEventInit}}.
{{Sensor}} {{Sensor/timestamp!!attribute}} attributes.
1. If [=identifying parameters=] in |options| are set, then:
1. Set |sensor_instance|.[=[[identifyingParameters]]=] to [=identifying parameters=].
1. Set |sensor_instance|.[=[[state]]=] to <a enum-value>"unconnected"</a>.
1. Set |sensor_instance|.[=[[state]]=] to <a enum-value>"idle"</a>.
1. Return |sensor_instance|.
</div>

Expand Down Expand Up @@ -1120,7 +1115,7 @@ Gets the {{Error}} object passed to {{SensorErrorEventInit}}.
: output
:: None

1. Set |sensor_instance|.[=[[state]]=] to <a enum-value>"errored"</a>.
1. Set |sensor_instance|.[=[[state]]=] to <a enum-value>"idle"</a>.
1. [=Fire an event=] named "error" at |sensor_instance| using {{SensorErrorEvent}}
with its {{SensorErrorEvent/error!!attribute}} attribute initialized to |error|.
</div>
Expand Down

0 comments on commit b68e171

Please sign in to comment.