MobileChromeApps / cordova-plugin-service-worker

163 stars 37 forks source link

sw.js cannot be found #7

Closed auser closed 9 years ago

auser commented 9 years ago

Where is sw.js located? Looks like it's not included in the repo...

mwoghiren commented 9 years ago

Hi there,

sw.js is a file you write and include in the www/ directory of your app. This plugin provides implementations of typical APIs you'll use in your sw.js file, like fetch and cache.

The README will soon include a lot more detail. If you're unfamiliar with ServiceWorkers, check this out; if you're already familiar, then most principles apply here; once you've installed this plugin, your existing sw.js file should work for your iOS app.

Please let us know if you have more questions. Thanks!

auser commented 9 years ago

Actually, I do have a q you may be able to answer quicker than I can discover it.

I'm loading my index.html remotely (i.e. http://[ip]:8080/index.html. With this plugin installed, looks likefetch` is being called on it and adding it to a load queue, which obviously disrupts loading the main file. Is there a way to dis-clude a file from being queued for remote fetch?

clelland commented 9 years ago

When you say that it disrupts loading, do you mean that it slows down the load, or that the load fails completely?

auser commented 9 years ago

The load fails completely

clelland commented 9 years ago

I'll definitely check that out, thanks. Do you have a service worker script installed at all?

auser commented 9 years ago

Nope, not yet.

clelland commented 9 years ago

Can you try adding a sw.js file beside your index.html (in your www/ folder) --even an empty one should allow the plugin to initialize, and then it will be able to process the queue, and your page should load.

It looks like we're not handling that case gracefully at all. I'm filing a bug for that right now.

clelland commented 9 years ago

Filed #8