However, sw-registration.js is always pointing to sw.js. This PR adds possibility to define which service worker should be registered while still producing the output to sw.js.
I still wonder if it's best possible solution or maybe there is some other way that I didn't think about. What do you think?
PS. I feel that my naming (serviceWorkerFileName) is rather confusing and should be changed before merge. Looking forward to your proposition if you agree we should move forward with it.
From https://github.com/DockYard/ember-service-worker/pull/81 Submitted by @jniechcial
Motivation
I am using ember-service-worker with OneSignal Push Notifications. Their SDK provides you service worker with following code:
And they claim that it's filename (
OneSignalSDKWorker.js
) is required for their SDK to work.Solution
I solved it by using the output service worker from
ember-service-worker
as animportScript
in the OneSignalSDK worker:However,
sw-registration.js
is always pointing tosw.js
. This PR adds possibility to define which service worker should be registered while still producing the output tosw.js
.I still wonder if it's best possible solution or maybe there is some other way that I didn't think about. What do you think?
PS. I feel that my naming (
serviceWorkerFileName
) is rather confusing and should be changed before merge. Looking forward to your proposition if you agree we should move forward with it.