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
docs(aio): add service worker guide #20736
Conversation
You can preview 0aa146c at https://pr20736-0aa146c.ngbuilds.io/. |
0aa146c
to
6d1d3be
Compare
You can preview 6d1d3be at https://pr20736-6d1d3be.ngbuilds.io/. |
You can preview 5e207d0 at https://pr20736-5e207d0.ngbuilds.io/. |
You can preview aedadf6 at https://pr20736-aedadf6.ngbuilds.io/. |
You can preview 8efb6bc at https://pr20736-8efb6bc.ngbuilds.io/. |
8efb6bc
to
e0d7fe3
Compare
You can preview e0d7fe3 at https://pr20736-e0d7fe3.ngbuilds.io/. |
You can preview 4522b3f at https://pr20736-4522b3f.ngbuilds.io/. |
4522b3f
to
e0d7fe3
Compare
You can preview 766a0c9 at https://pr20736-766a0c9.ngbuilds.io/. |
You can preview dc39778 at https://pr20736-dc39778.ngbuilds.io/. |
You can preview c79275b at https://pr20736-c79275b.ngbuilds.io/. |
f945fe9
to
83fe3dc
Compare
You can preview f945fe9 at https://pr20736-f945fe9.ngbuilds.io/. |
You can preview 83fe3dc at https://pr20736-83fe3dc.ngbuilds.io/. |
83fe3dc
to
8dd050d
Compare
You can preview 8dd050d at https://pr20736-8dd050d.ngbuilds.io/. |
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.
lgtm for package.json and other config changes. I haven't reviewed the content, but I don't expect that I was supposed 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.
I haven't looked at the actual content (*.md
files), but here are some comments:
The offline-checkbox image has the Memory
highlighted (although not the current tab), which is a little confusing. Can we have an image with the Network
tab highlighted?
The welcome-msg-en.png image says "Welcome to app", but the actual app will show "Welcome to Service Workers". Same for the welcome-msg-fr.png
.
The empty aio/content/examples/service-worker-getstart/src/app/app.component.css
should be removed.
"tooltip": "The ngsw-config.json configuration file controls service worker caching behavior." | ||
} | ||
] | ||
}, |
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.
Should Service Workers
be in Fundamentals
(rather than Techniques
)? (Just checking...)
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.
Service Workers is under Fundamentals.
{ | ||
"url": "guide/service-worker-devops", | ||
"title": "Service Workers in Production", | ||
"tooltip": "Information about running applications with service workers, including application update management, debugging, and killing applications." |
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 tooltip is a little too long. How about:
Running applications with service workers, managing application update, debugging, and killing applications.
{ | ||
"url": "guide/service-worker-configref", | ||
"title": "Reference: Configuration File", | ||
"tooltip": "The ngsw-config.json configuration file controls service worker caching behavior." |
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.
Why not Configuring service worker caching behavior
(to be more consistent with other tooltips)?
If you look at the Network tab, you can verify that the service worker is active. | ||
|
||
<figure> | ||
<img src="generated/images/guide/service-worker/sw-active.png" alt="Requests are marked as from ServiceWorker"> |
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 image is too wide and gets truncated at certain screen sizes. Make sure it is no wider than 660px.
@Component({ | ||
selector: 'app-root', | ||
templateUrl: './app.component.html', | ||
styleUrls: ['./app.component.css'] |
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.
If this is not needed, let's remove it.
it(`should have as title 'app'`, async(() => { | ||
const fixture = TestBed.createComponent(AppComponent); | ||
const app = fixture.debugElement.componentInstance; | ||
expect(app.title).toEqual('app'); |
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.
Shouldn't it be Service Workers
? Are these tests run at all (I don't think so). Do we need them (given that they are pretty basic and the assertions could/should be covered in the e2e tests)?
|
||
describe('sw-example App', () => { | ||
let page: AppPage; | ||
let logo = element(by.css('img')); |
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.
Since this is only used once, why not move it inside the respective test?
}); | ||
}); | ||
|
||
}); |
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.
We should somehow include the services into the tests. Right now, the only ServiceWorker related thing that is tested is ServiceWorkerModule.register(...)
. We should include the services into the app (i.e. inject them somewhere) and ensure that they at least do not break.
"resources": { | ||
"files": [ | ||
"/favicon.ico", | ||
"/index.html" |
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.
Does index.html
have to be in 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.
yes - Checked with Alex
import { SwUpdate } from '@angular/service-worker'; | ||
|
||
import { Observable } from 'rxjs/Observable'; | ||
import 'rxjs/add/observable/interval'; |
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.
It is better to replace the above 2 lines with: import { interval } from 'rxjs/observable/interval';
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 app fails to compile when we remove the import Observable line. So keeping it as is.
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.
It fails to compile, because you still mention Observable.interval
below. It should be changed to just interval
(in addition to replacing the above two lines per my previous comment.
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.
ok
Oh...too late 😞 |
@gkalpak @chembu is going to address these comments in a new PR. Handing this back to @chembu now. |
Awesome! Feel free to ping me if you want me to take look. |
@chembu ^^ |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Adds new Service Worker documentation and example.
Does this PR introduce a breaking change?
Other information
This PR is for working out the problems in the original SW PR #20716.