jkleinsc / broccoli-serviceworker

ServiceWorker generator for Broccoli and Ember.js
MIT License
92 stars 27 forks source link

Javascripts under app/serviveworkers not added to generated service worker #50

Open hronik1 opened 7 years ago

hronik1 commented 7 years ago

Per the README, "If you wish to add your own logic to the generated service worker, you can place that code in .js files in app/serviceworkers."

I have the following as the last entry in my Brocfile.js:

module.exports = Merge([tree, writeServiceWorker(tree, {
  enabled: true,
  debug: true,
  serviceWorkerFile: "browser-push-service-worker.js",
  includeRegistration: false
})]);

As well as the following under app/serviceworkers/browser-push-service-worker.js:

self.addEventListener('pushsubscriptionchange',
  function() {
    console.log('pushsubscriptionchanged');
  }
);

The documentation would suggest that after I perform an ember build, I should see the event listener added to the generated service worker at dist/browser-push-service-worker.js, however it just appears to be a renamed version of the default service-worker.js.

jkleinsc commented 7 years ago

@hronik1 is this for an Ember app or some other kind of app? You shouldn't need to specify broccoli-serviceworker options in a Brocfile for an Ember app.