WakeLockSentinel.type

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

安全なコンテキスト用: この機能は一部またはすべての対応しているブラウザーにおいて、安全なコンテキスト (HTTPS) でのみ利用できます。

typeWakeLockSentinel インターフェイスの読み取り専用プロパティで、現在取得している WakeLockSentinel の種別の文字列表現を返します。

構文

js
var type = sentinel.type;

現在取得している起動ロックの種別の文字列表現です。

type 読取専用

返される値は以下の通りです。

  • 'screen': 画面の起動ロックです。端末の画面が暗くなったりロックされたりすることを防ぎます。

この例は、 WakeLockSentinel を取得し、コンソールにその種別を出力する非同期関数の例を示しています。

js
const requestWakeLock = async () => {
  wakeLock = await navigator.wakeLock.request("screen");
  console.log(wakeLock.type); // 'screen' と出力
};

requestWakeLock();

仕様書

Specification
Screen Wake Lock API
# the-type-attribute

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
type

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Partial support
Partial support