-
Notifications
You must be signed in to change notification settings - Fork 338
Conversation
@delapuente, thanks for your PR! By analyzing the annotation information on this pull request, we identified @darkwing, @brendandahl and @digitarald to be potential reviewers |
|
||
## Solution | ||
Add static content during the installation of the service worker and use the | ||
cache to retrieve it whether there were network or not. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think "whether the network is available or not" would sound a bit more idiomatic
<body> | ||
<h1>Cache only</h1> | ||
<img src="./asset" alt="sample asset" /> | ||
<p>This image request originates from a controlled page so the image will |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does a "controlled page" mean? Is it a page under the service worker scope? (maybe it'd be better to describe it like that?)
@@ -0,0 +1,45 @@ | |||
// Register the ServiceWorker limiting its action to those URL starting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about "limiting its scope of action", or "limiting its scope"?
</style> | ||
</head> | ||
<body> | ||
<h1>Always synchronized</h1> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure 'synchronized' works here, perhaps 'always fresh from the server' would be more clear. Synchronized makes me think of synchronising content both ways and that's not what's happening...
@@ -0,0 +1,34 @@ | |||
var CACHE = 'cache-only'; | |||
|
|||
// On install, cache some resource. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some resources
}); | ||
|
||
// Open a cache and use `addAll()` with an array of assets to add all of them | ||
// to the cache. Extend the installation until all the assets are saved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does 'extend the installation' mean? do you mean the installation isn't finished until the assets are saved to the cache?
}); | ||
} | ||
|
||
// As simple as opening the proper cache and search for the requested resource. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"simple" is very relative. I'd suggest rewriting this comment as something like 'We will open the cache where we stored the data before, and search for the requested resource'
} | ||
|
||
// As simple as opening the proper cache and search for the requested resource. | ||
// Notice in case of no matching, undefined is passed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'returned', rather than 'passed'
533ed57
to
09448d7
Compare
@sole done. I though your comments will dissapear or shown as obsolete but they did not. Anyway, the las commit made the changes. |
09448d7
to
4adefd4
Compare
4adefd4
to
668583e
Compare
<iframe src="./non-controlled.html" id="reference"></iframe> | ||
<iframe src="./controlled.html" id="sample"></iframe> | ||
</div> | ||
<p>The images in these iframes points to the same asset in the server. But the first is controlled by the service worker and the second is not.</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*point
var referenceIframe = document.getElementById('reference'); | ||
var sampleIframe = document.getElementById('sample'); | ||
|
||
// Fix heights every time the iframe reload. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*"is reloaded" or "reloads" ?
668583e
to
2e24dc4
Compare
No description provided.