Angular: Type '"periodic-background-sync"' is not assignable to type 'PermissionName'

Discussão em 'Angular' iniciado por Péter, Março 7, 2025.

  1. Péter

    Péter Guest

    I try to activate a background-sync, but i run to error when I typing the code. Why can't find it?

    Should i update something?

    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.
    }
    }

    Continue reading...

Compartilhe esta Página