PeriodicSyncManager: getTags() メソッド

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

getTags()PeriodicSyncManager インターフェイスのメソッドで、定期的な同期を行うために現在登録されているタグを表す String オブジェクトのリストで解決される Promise を返します。

構文

js
getTags()

引数

なし。

返値

定期的な同期を行うために現在登録されているタグを表す String オブジェクトのリストで解決される Promise です。

例外

なし。

次の例では、getTags() メソッドを使用して、指定されたタグを持つ定期的な同期タスクが登録されているかどうかを調べています。

js
navigator.serviceWorker.ready.then((registration) => {
  registration.periodicSync.getTags().then((tags) => {
    if (tags.includes("get-latest-news")) skipDownloadingLatestNewsOnPageLoad();
  });
});

skipDownloadingLatestNewsOnPageLoad() は開発者が定義した関数です。

仕様書

Specification
Web Periodic Background Synchronization
# dom-periodicsyncmanager-gettags

ブラウザーの互換性

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
getTags
Experimental

Legend

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

Full support
Full support
No support
No support
Experimental. Expect behavior to change in the future.

関連情報