PushSubscription: unsubscribe() メソッド
Baseline 2023Newly available
Since March 2023, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
unsubscribe()
は PushSubscription
インターフェイスのメソッドで、現在のサブスクリプションから脱退に成功したときに論理値で解決される Promise
を返します。
構文
js
unsubscribe()
引数
なし。
返値
現在のサブスクリプションから脱退に成功したときに論理値で解決される Promise
です。
例
js
navigator.serviceWorker.ready.then((reg) => {
reg.pushManager.getSubscription().then((subscription) => {
subscription
.unsubscribe()
.then((successful) => {
// 登録脱退が成功
})
.catch((e) => {
// 登録脱退が失敗
});
});
});
仕様書
Specification |
---|
Push API # dom-pushsubscription-unsubscribe |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
unsubscribe() |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
- See implementation notes.
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.