-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement amp-install-serviceworker #954
Conversation
b25d418
to
7b39e42
Compare
Fixes #586 |
*/ | ||
class AmpServiceWorkerInstallation extends AMP.BaseElement { | ||
/** @override */ | ||
isLayoutSupported(layout) { |
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.
This is the default, so you don't have to include it here.
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.
Done
In light of #800 - should we rename this component to e.g. amp-install-sw, amp-install-app |
|
||
### <a name="amp-serviceworker-installation"></a> `amp-serviceworker-installation` | ||
|
||
The `amp-serviceworker-installation` component allows installing a [ServiceWorker](http://www.html5rocks.com/en/tutorials/service-worker/introduction/) for the current page. |
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.
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.
The article above is a bit better for a 1st time user.
@jmadler Good point. These are, of course, very different in that this component executes without user action. |
|
||
The `amp-serviceworker-installation` component allows installing a [ServiceWorker](http://www.html5rocks.com/en/tutorials/service-worker/introduction/) for the current page. | ||
|
||
The idea here is that this ServiceWorker runs whenever the AMP file is served from the origin where you publish the AMP file. The ServiceWorker will not be loaded when the document is loaded from an AMP cache. |
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.
Can we clarify which hostname the SW is registered to?
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.
That isn't really the right dimension for SW since it uses path based origins.
7b39e42
to
6897a2e
Compare
LGTM on my side |
6897a2e
to
269a41e
Compare
would love to try and use this on ampproject.org 💃 |
269a41e
to
41870aa
Compare
Renamed to |
Allows AMP pages to install a ServiceWorker to among other things implement the pattern described in https://medium.com/@cramforce/amps-and-websites-in-the-age-of-the-service-worker-8369841dc962
41870aa
to
e6199cf
Compare
Implement amp-install-serviceworker
Thanks - spun off #981 for cross-origin support |
Does this support "app install banners"? |
Allows AMP pages to install a ServiceWorker to among other things
implement the pattern described in
https://medium.com/@cramforce/amps-and-websites-in-the-age-of-the-service-worker-8369841dc962