OneSignal / onesignal-ngx

OneSignal Angular
Other
5 stars 5 forks source link

How to use serviceWorkerParam and serviceWorkerPath? #11

Closed classicPintus closed 2 years ago

classicPintus commented 2 years ago

Hello, I'm not understanding how to use serviceWorkerParam and serviceWorkerPath in combination with this library.

Please Can you provide a little example?

Thank you

rgomezp commented 2 years ago

Howdy Gavino, Thanks for your patience.

The params are passed as initialization options:

this.oneSignal.init({
   appId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
   serviceWorkerParam: {
      scope: "<path scope>"
   },
   serviceWorkerPath: '<path>'
}).then(() => {
  // do other stuff
});

Hope that helps!

dylanvdmerwe commented 2 years ago

It would be amazing if you could provide an example. What would a scope look like?

rgomezp commented 2 years ago

@dylanvdmerwe , It would be something like:

this.oneSignal.init({
   appId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
   serviceWorkerParam: {
      scope: "/push"
   },
   serviceWorkerPath: '<path>'
}).then(() => {
  // do other stuff
});

You can learn more here.