PushSubscriptionOptions.userVisibleOnly
利用可能性は限定的
この機能はベースラインではありません。最も広く使用されているブラウザーの一部で動作しません。
PushSubscriptionOptions の userVisibleOnly 読み取り専用プロパティは、プッシュサブスクリプションがユーザーに見える効果を持つメッセージのみに使われるかどうかを表します。
値
プッシュサブスクリプションがユーザーに見える効果を持つメッセージのみに使われるかどうかを表す Boolean 値です。
例
この例では、userVisibleOnly の値をコンソールに出力します。
js
navigator.serviceWorker.ready.then((reg) => {
reg.pushManager.getSubscription().then((subscription) => {
const options = subscription.options;
console.log(options.userVisibleOnly); // ユーザーに見えるサブスクリプションであれば true
});
});
仕様書
| 仕様書 |
|---|
| Push API> # dom-pushsubscriptionoptions-uservisibleonly> |