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 registerOneSignalSDKWorker.js
.
The package will create aOneSignalSDKWorker.js
at the root of your app with the following contentimportScripts('/service-worker.js?xxxxx', 'https://cdn.onesignal.com/sdks/OneSignalSDKWorker.js');
-
@motia I’m trying to use your package to integrate OneSignal with our app. I’ve got to the point where there are no visible errors (eg it’s getting the right API key and not complaining about the domain), but app.$oneSignal.setup(apiKey) doesn’t seem to actually be doing anything I can see.
I’m using OneSignal’s “Typical Site Setup” with a slide prompt. My expectation is that when the setup method is triggered from app.vue, the slide prompt will appear. Does your package require using OneSignal’s Custom Code setting with my own prompt?
-
@motia said in How to use oneSignal for push notification with Quasar PWA ?:
ou will need to add the pwa mode to your quasar app. then modify the src-pwa/register-service-worker.js to register
Thanks motia!
I checked the package and installed it running:- npm install quasar-app-extension-onesignal
- quasar ext invoke onesignal
but I don’t know where insert the code wrote in teh documentation of the package
Whre I should add: “$vm.$oneSignal === {…” in my quasar project?