PeriodicSyncManager: getTags() メソッド
Experimental: これは実験的な機能です。
本番で使用する前にブラウザー互換性一覧表をチェックしてください。
getTags()
は PeriodicSyncManager
インターフェイスのメソッドで、定期的な同期を行うために現在登録されているタグを表す String
オブジェクトのリストで解決される Promise
を返します。
構文
js
getTags()
引数
なし。
返値
例外
なし。
例
次の例では、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 GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
getTags |
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.
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.