Skip to content
This repository has been archived by the owner on Aug 31, 2021. It is now read-only.

networkFirst timeout #34

Merged
merged 4 commits into from
Sep 22, 2015
Merged

networkFirst timeout #34

merged 4 commits into from
Sep 22, 2015

Conversation

jeffposnick
Copy link
Contributor

R: @wibblymat

Closes #12, although it doesn't enforce the network timeout by default.

I put together a super-simple page in demo/index.html that registers a service worker, mainly to play around with in DevTools. It can be fleshed out a bit more in the future, which is tracked in #9.

None of the existing tests that exercise networkFirst break, but I didn't add any new ones—if you have any ideas for simulating a slow network for just one test case, I'm all ears.

There are also miscellaneous changes to the docs—new docs for networkTimeoutSeconds, updates to a few copyright years, and correcting the documentation for the cacheName option.

@@ -186,7 +186,7 @@ Apache License
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright ${copyright_attribution}
Copyright 2015 Google, Inc.
Copy link
Contributor

Choose a reason for hiding this comment

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

I "fixed" this too, early on, but if you read the text this is NOT the copyright statement for the project, but rather the template for how to apply the license to other projects.

Most methods that involve a cache (`toolbox.cache`, `toolbox.uncache`, `toolbox.fastest`, `toolbox.cacheFirst`, `toolbox.cacheOnly`, `toolbox.networkFirst`) accept an option called `cache`, which is the **name** of the [Cache](https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache) that should be used. If not specifed Service Worker Toolbox will use a default cache.
Most methods that involve a cache (`toolbox.cache`, `toolbox.uncache`, `toolbox.fastest`, `toolbox.cacheFirst`, `toolbox.cacheOnly`, `toolbox.networkFirst`) accept an option called `cacheName`, which is the **name** of the [Cache](https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache) that should be used. If not specified, Service Worker Toolbox will use a default cache.

The `networkFirst` strategy supports a timeout, specified in seconds via the `networkTimeoutSeconds`
Copy link
Contributor

Choose a reason for hiding this comment

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

I know that I would have just called it timeout, but I also know that I'm lazy and fond of shortcuts. I leave it to your judgement :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think anyone will mind the verbosity. If there ends up being some other sort of configurable timeout in the future (not outside the realm of possibility), using a more descriptive identifier here will end up paying off.

@wibblymat
Copy link
Contributor

LGTM, resolve the remaining two nits or not at your discretion :)

jeffposnick added a commit that referenced this pull request Sep 22, 2015
@jeffposnick jeffposnick merged commit 1ba5d7f into master Sep 22, 2015
@jeffposnick jeffposnick deleted the network-first-timeout branch September 22, 2015 03:02
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.

2 participants