Skip to content
This repository was archived by the owner on May 3, 2019. It is now read-only.

add PWA support with caching#23

Open
sgametrio wants to merge 2 commits intoquasarframework:masterfrom
sgametrio:master
Open

add PWA support with caching#23
sgametrio wants to merge 2 commits intoquasarframework:masterfrom
sgametrio:master

Conversation

@sgametrio
Copy link

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

  • It's submitted to the dev branch and not the master branch
  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix: #xxx[,#xxx], where "xxx" is the issue number)
  • It's been tested with all Quasar themes
  • It's been tested on a Cordova (iOS, Android) app
  • It's been tested on a Electron app
  • Any necessary documentation has been added or updated in the docs (for faster update click on "Suggest an edit on GitHub" at bottom of page) or explained in the PR's description.

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)

Other information:
Add initial PWA support with sw-precache caching of js and css files. In production (only on HTTPS) instantiate a service worker, so the browser can ask you if you want install your app without doing any additional step. The service worker part could be done better but I want to give instant support to ones who want to use PWA in their entirety. Let me know if something isn't working or if I did an hole in the water ;)


runtimeCaching: [{
urlPattern: /\/.*/,
handler: 'networkFirst'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you choose networkFirst? I would prefer using the cached copies first, then refetching the changed files and using them on the next reload. If I understand correctly networkFirst would refetch the unchanged files on all refresh which would be suboptimal on mobile internet, right?

Copy link
Author

@sgametrio sgametrio May 31, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're right, cache-first approach seems to be very nice on mobile. The problem is that this configuration has to be changed based on projects. There is no configuration that fits well on every project, some needs network-first, some need fastest, depending always on what resources are we caching. Thanks though for the tip. Let's talk again after v0.14

@rstoenescu
Copy link
Member

Hi, thank you for this PR.

Can we schedule a talk after the v0.14 release? Currently on a very tight schedule to release the new version, but after that it's time for some new starter kits, and a PWA one is scheduled too. The PWA needs to be another repo entirely as it doesn't makes sense to add this to the default template which can be wrapped by Cordova or Electron too.

So a talk after v0.14?

@sgametrio
Copy link
Author

Sure man.
I put this PR here because it is what I am using right now (I don't care about Electron and Cordova so it fits very well on my project). It is a base on what we can do with sw-precache. Let's talk about it after v0.14 release. in the meantime, i will keep it up-to-date here as placeholder

@sgametrio sgametrio changed the title add PWA support with little caching add PWA support with caching May 31, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants