How to use oneSignal for push notification with Quasar PWA ?



  • oneSignal documentation states that other service worker should be imported into oneSignal’s one or it wouldn’t work, doing that :

    importScripts('https://site.com/my-other-service-worker.js');
    

    How can I make this requirement compatible with quasar PWA service worker ?



  • I have created a package that supports on pwa and spa modes.

    https://github.com/motia/quasar-app-extension-onesignal

    You will need to add the pwa mode to your quasar app. then modify the src-pwa/register-service-worker.js to register OneSignalSDKWorker.js.
    The package will create a OneSignalSDKWorker.js at the root of your app with the following content

    importScripts('/service-worker.js?xxxxx', 'https://cdn.onesignal.com/sdks/OneSignalSDKWorker.js'); 
    

Log in to reply