diff options
Diffstat (limited to 'files/pt-br/web/api/sensor/index.html')
-rw-r--r-- | files/pt-br/web/api/sensor/index.html | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/files/pt-br/web/api/sensor/index.html b/files/pt-br/web/api/sensor/index.html new file mode 100644 index 0000000000..afc91f60d5 --- /dev/null +++ b/files/pt-br/web/api/sensor/index.html @@ -0,0 +1,89 @@ +--- +title: Sensor +slug: Web/API/Sensor +tags: + - API + - Generic Sensor API + - Interface + - NeedsTranslation + - Reference + - Sensor + - Sensor APIs + - Sensors + - TopicStub +translation_of: Web/API/Sensor +--- +<div>{{APIRef("Generic Sensor API")}}</div> + +<p><span class="seoSummary">The <strong><code>Sensor</code></strong> interface of the the <a href="/docs/Web/API/Sensor_APIs">Sensor APIs</a> is the base class for all the other sensor interfaces. This interface cannot be used directly. Instead it provides properties, event handlers, and methods accessed by interfaces that inherit from it.</span></p> + +<p>If a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. This is not something that would ever be shown to a user. See {{httpheader('Feature-Policy')}} for implementation instructions.</p> + +<h2 id="Interfaces_based_on_Sensor">Interfaces based on Sensor</h2> + +<p>Below is a list of interfaces based on the Sensor interface.</p> + +<div class="index"> +<ul> + <li>{{domxref('Accelerometer')}}</li> + <li>{{domxref('AmbientLightSensor')}}</li> + <li>{{domxref('Gyroscope')}}</li> + <li>{{domxref('LinearAccelerationSensor')}}</li> + <li>{{domxref('Magnetometer')}}</li> + <li>{{domxref('OrientationSensor')}}</li> +</ul> +</div> + +<h2 id="Properties">Properties</h2> + +<dl> + <dt>{{domxref('Sensor.activated')}} {{readonlyinline}}</dt> + <dd>Returns a {{jsxref("Boolean")}} indicating whether the sensor is active.</dd> + <dt>{{domxref('Sensor.hasReading')}} {{readonlyinline}}</dt> + <dd>Returns a {{jsxref("Boolean")}} indicating whether the sensor has a reading.</dd> + <dt>{{domxref('Sensor.timestamp')}} {{readonlyinline}}</dt> + <dd>Returns the time stamp of the latest sensor reading.</dd> +</dl> + +<h3 id="Event_handlers">Event handlers</h3> + +<dl> + <dt>{{domxref('Sensor.onerror')}}</dt> + <dd>Called when an error occurs on one of the child interfaces of the <code>Sensor</code> interface.</dd> + <dt>{{domxref('Sensor.onreading')}}</dt> + <dd>Called when a reading is taken on one of the child interfaces of the Sensor interface.</dd> + <dt>{{domxref('Sensor.onactivate')}}</dt> + <dd>Called when one of the Sensor interface's becomes active.</dd> +</dl> + +<h2 id="Methods">Methods</h2> + +<dl> + <dt>{{domxref('Sensor.start()')}}</dt> + <dd>Activates one of the sensors based on <code>Sensor</code>.</dd> + <dt>{{domxref('Sensor.stop()')}}</dt> + <dd>Deactivates one of the sensors based on <code>Sensor</code>.</dd> +</dl> + +<h2 id="Specifications">Specifications</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + <tr> + <td>{{SpecName('Generic Sensor','#the-sensor-interface','Sensor')}}</td> + <td>{{Spec2('Generic Sensor')}}</td> + <td>Initial definition.</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + + + +<p>{{Compat("api.Sensor")}}</p> |