I am trying to enable background sync, but I keep encountering an error when I try to enter the code. Why can't it be found?
Do I need to update something?
This is my code:
if ('periodicSync' in worker) {
const status = await navigator.permissions.query({
name: 'periodic-background-sync', //ERROR
});
// Periodic background sync can be used.
if (status.state === 'granted') {
const tags = await worker.periodicSync.getTags(); //ERROR
if (!tags.includes('sendDbDatas')) {
worker.periodicSync.register('sendDbDatas'); //ERROR
}
} else {
// Periodic background sync cannot be used.
}
}