CookieStoreManager: unsubscribe() メソッド

Limited availability

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

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

Experimental: これは実験的な機能です。
本番で使用する前にブラウザー互換性一覧表をチェックしてください。

CookieStoreManager インターフェイスの unsubscribe() メソッドは、ServiceWorkerRegistration が以前購読していたイベントを受け取るのを止めます。

構文

js
unsubscribe(subscriptions)

引数

subscriptions

以下が格納されたオブジェクトです。

name

Cookie の名前を表す文字列です。

url

この Cookie の購読に使用していたスコープの URL を表す文字列です。

返値

サービスワーカーの購読の解除が完了したら undefined で解決する Promise を返します。

例外

TypeError

subscriptions に渡された URL がサービスワーカーの登録の scope とマッチしないとき投げられます。

この例では、registration で表される ServiceWorkerRegistration が、名前が "cookie1" でスコープが "/path1" である Cookie の変更イベントの購読を解除します。

js
const subscriptions = [{ name: "cookie1", url: `/path1` }];
await registration.cookies.unsubscribe(subscriptions);

仕様書

Specification
Cookie Store API
# dom-cookiestoremanager-unsubscribe

ブラウザーの互換性

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
unsubscribe

Legend

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

Full support
Full support
No support
No support