Magnetometer: Magnetometer() コンストラクター
        
        
          Limited availability
        
        
        
          
                
              
                
              
                
              
        
        
      
      This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimental: これは実験的な機能です。
本番で使用する前にブラウザー互換性一覧表をチェックしてください。
Magnetometer() コンストラクターは、デバイスのプライマリー磁気センサーで検出される磁場の情報を返す新しい Magnetometer オブジェクトを生成します。
構文
js
new Magnetometer()
new Magnetometer(options)
引数
- options省略可
- 
以下のオプションがあります。 - frequency
- 
1 秒間にサンプルを何回取得したいかであり、 readingイベントが呼ばれる 1 秒あたりの回数になります。整数または小数が使用でき、小数は 1 秒に 1 回未満の頻度を設定するのに用います。実際の取得頻度はデバイスハードウェアに依存するので、要求値より少なくなる可能性があります。
- referenceFrame
- 
'device'または'screen'です。デフォルトは'device'です。
 
例外
- SecurityError- DOMException
- 
この機能の使用が 権限ポリシー によりブロックされました。 
仕様書
| Specification | 
|---|
| Magnetometer> # dom-magnetometer-magnetometer> | 
ブラウザーの互換性
Loading…
関連情報
- readingイベント