PeriodicSyncManager: getTags() method
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
Note: This feature is available in Web Workers.
The getTags()
method of the
PeriodicSyncManager
interface returns a Promise
that
resolves with a list of String
objects representing the tags that are
currently registered for periodic syncing.
Syntax
js
getTags()
Parameters
None.
Return value
Exceptions
None.
Examples
The following example uses the getTags()
method to check if a periodic
sync task with a given tag is registered.
js
navigator.serviceWorker.ready.then((registration) => {
registration.periodicSync.getTags().then((tags) => {
if (tags.includes("get-latest-news")) skipDownloadingLatestNewsOnPageLoad();
});
});
skipDownloadingLatestNewsOnPageLoad()
is a developer defined function.
Specifications
Specification |
---|
Web Periodic Background Synchronization # dom-periodicsyncmanager-gettags |
Browser compatibility
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.