Is there a way to reset window.launchQueue?

Discussão em 'Angular' iniciado por noBeansChili, Março 28, 2025.

  1. noBeansChili

    noBeansChili Guest

    The PWA I am trying to build retriggers the window.launchQueue-Consumer every time the App is reloaded.

    I am trying to set up a Angular PWA that can handle links with the tel-Protocol. I've been following a guide from Google to set up the protocol handler in the manifest.json of my PWA.

    Because the app is an Angular One-Pager and used to make calls with VoIP, I used "launch_handler": {"client_mode": "focus-existing"} to stop the app from reloading once the PWA is opened with a tel link. To still get the telephone-number I use the window.launchQueue and its setConsumer method.

    My problem is, that once a launch parameter is handed to the launch queue, it is re-consumed every time I reload my PWA. Which also means the respective call will be triggered on every reload.

    Is there a way to clear the launch queue and only consume the parameter once?

    The code setting the Consumer inside the ngOnInit method of my app.component.ts:

    if ("launchQueue" in window && typeof window.launchQueue == 'object' && 'setConsumer' in window.launchQueue && typeof window.launchQueue.setConsumer == 'function') {
    window.launchQueue.setConsumer((launchParams) => {
    if(launchParams.targetURL && launchParams.targetURL.includes('call/?number=tel')) {
    let link = new URL(launchParams.targetURL).searchParams.get('number')
    let number = link.split(':')[1]
    this.handleTelLink(number)
    }
    })
    }

    Continue reading...

Compartilhe esta Página