Sensor: activate イベント
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
activate
イベントは、センサーの動作が開始したとき発火します。これは、センサーが測定値の取得を開始したということです。
Sensor
はベースクラスであり、onactivate
および activate
イベントは派生クラスからのみ利用可能です。
構文
addEventListener()
のようなメソッドでイベント名を用いるか、イベントハンドラープロパティを設定します。
js
addEventListener("activate", (event) => {});
onactivate = (event) => {};
イベント型
汎用の Event
であり、追加されたプロパティはありません。
例
加速度計の測定の準備ができたとき記録する
この例では、Accelerometer
の動作開始を記録するイベントリスナーを追加します。
js
const acl = new Accelerometer({ frequency: 60 });
acl.addEventListener("activate", () => console.log("測定の準備ができました。"));
acl.start();
仕様書
Specification |
---|
Generic Sensor API # sensor-onactivate |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
activate event |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.