Skip to content

Commit 063a65f

Browse files
committed
Integrate proofreading for Chapter 21
1 parent 980f27a commit 063a65f

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

21_skillsharing.txt

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ I've visited to be friendly and welcoming.
2121

2222
In this final project chapter, our goal is to set up a ((website))
2323
for managing ((talk))s given at a skill-sharing meeting. Imagine a
24-
small group of people, meeting up regularly in a member’s
24+
small group of people meeting up regularly in a member’s
2525
office to talk about ((unicycling)). The problem is that when the previous
2626
organizer of the meetings moved to another town, nobody stepped
2727
forward to take over this task. We want a system that will let the
@@ -60,7 +60,7 @@ view of the current proposed talks and their comments. Whenever
6060
someone, somewhere, submits a new talk or adds a comment, all people
6161
who have the page open in their browsers should immediately see the
6262
change. This poses a bit of a challenge since there is no way for a
63-
web server to open up a connection to a client nor is there a good
63+
web server to open up a connection to a client, nor is there a good
6464
way to know which clients currently are looking at a given website.
6565

6666
(((Node.js)))A common solution to this problem is called _((long
@@ -88,16 +88,16 @@ open ((connection))s for arbitrary data exchange. But using them
8888
properly is somewhat tricky.
8989

9090
In this chapter, we will use a relatively simple technique, ((long
91-
polling)), where clients continuously ask the server for new information,
91+
polling)), where clients continuously ask the server for new information
9292
using regular HTTP requests, and the server simply stalls its answer
9393
when it has nothing new to report.
9494

9595
(((live view)))As long as the client makes sure it constantly has a
9696
polling request open, it will receive information from the server
9797
immediately. For example, if Alice has our skill-sharing application
9898
open in her browser, that browser will have made a request for
99-
updates and be waiting for a response to that request. When Bob, from
100-
his own browser, submits a talk on Extreme Downhill Unicycling, the
99+
updates and be waiting for a response to that request. When Bob
100+
submits a talk on Extreme Downhill Unicycling, the
101101
server will notice that Alice is waiting for updates and send
102102
information about the new talk as a response to her pending request.
103103
Alice's browser will receive the data and update the screen to show
@@ -333,12 +333,12 @@ contains `%20`-style codes.
333333
=== Serving files ===
334334

335335
When a request matches none of the request types defined in our
336-
router, the server must interpret it as being a request for a file in
336+
router, the server must interpret it as a request for a file in
337337
the `public` directory. It would be possible to use the file server
338338
defined in link:20_node.html#file_server[Chapter 20] to serve such
339339
files, but we neither need nor want to support `PUT` and
340340
`DELETE` requests on files, and we would like to have advanced
341-
features such as support for caching. So, let's use a solid, well-tested
341+
features such as support for caching. So let's use a solid, well-tested
342342
((static file)) server from ((NPM)) instead.
343343

344344
(((createServer function)))(((ecstatic module)))I opted for
@@ -370,8 +370,7 @@ http.createServer(function(request, response) {
370370
----
371371

372372
(((JSON)))The `respond` and `respondJSON` helper functions are used throughout the
373-
server code to be able to send off responses with a single function
374-
call.
373+
server code to send off responses with a single function call.
375374

376375
// include_code >code/skillsharing/skillsharing_server.js
377376

@@ -438,8 +437,8 @@ router.add("DELETE", /^\/talks\/([^\/]+)$/,
438437
will define link:21_skillsharing.html#registerChange[later], notifies
439438
waiting long-polling requests about the change.
440439

441-
(((readStreamAsJSON function)))(((body (HTTP))))To be able to easily
442-
get the content of ((JSON))-encoded request bodies, we define a
440+
(((readStreamAsJSON function)))(((body (HTTP))))To retrieve
441+
the content of ((JSON))-encoded request bodies, we define a
443442
function called `readStreamAsJSON`, which reads all content from a stream,
444443
parses it as JSON, and then calls a callback function.
445444

@@ -562,7 +561,7 @@ needs to look at the query parameters in the request's URL to see
562561
whether a `changesSince` parameter is given. If you give the `"url"` module's
563562
`parse` function a second argument of `true`, it will
564563
also parse the query part of a URL. The object it returns will have a
565-
`query` property, holding another object that maps parameter names to
564+
`query` property, which holds another object that maps parameter names to
566565
values.
567566

568567
// include_code >code/skillsharing/skillsharing_server.js
@@ -870,7 +869,7 @@ appropriate initial value for `lastServerTime`.
870869

871870
(((error handling)))(((user experience)))When the request fails, we
872871
don't want to have our page just sit there, doing nothing without
873-
explanation. So, we define a simple function called `reportError`, which at
872+
explanation. So we define a simple function called `reportError`, which at
874873
least shows the user a dialog that tells them something went wrong.
875874

876875
// include_code >code/skillsharing/public/skillsharing_client.js
@@ -895,7 +894,7 @@ to the user.
895894
the talks when changes come in, the client must keep track of the
896895
talks that it is currently showing. That way, when a new version of a
897896
((talk)) that is already on the screen comes in, the talk can be replaced
898-
(in-place) with its updated form. Similarly, when information comes in
897+
(in place) with its updated form. Similarly, when information comes in
899898
that a talk is being deleted, the right DOM element can be removed
900899
from the document.
901900

@@ -934,7 +933,7 @@ function displayTalks(talks) {
934933

935934
(((drawTalk function)))(((instantiation)))Building up the DOM
936935
structure for talks is done using the ((template))s that were included
937-
in the HTML document. First we must define `instantiateTemplate`,
936+
in the HTML document. First, we must define `instantiateTemplate`,
938937
which looks up and fills in a template.
939938

940939
(((class attribute)))(((querySelector method)))The `name` parameter is the
@@ -1148,7 +1147,7 @@ to ensure that a polling request is always active. When the request
11481147
fails, we don't call `reportError` since popping up a dialog every
11491148
time we fail to reach the server would get annoying when the
11501149
server is down. Instead, the error is written to the console (to ease
1151-
debugging), and another attempt is made two-and-a-half seconds later.
1150+
debugging), and another attempt is made 2.5 seconds later.
11521151

11531152
When the request succeeds, the new data is put onto the screen, and
11541153
`lastServerTime` is updated to reflect the fact that we received data
@@ -1302,7 +1301,7 @@ completely broken, inoperable page. This is not nice.
13021301
Some types of ((web application))s really can't be done without
13031302
JavaScript. For others, you just don't have the ((budget)) or patience
13041303
to bother about clients that can't run scripts. But for pages with a
1305-
wide audience, it is polite to support script-less users.
1304+
wide audience, it is polite to support scriptless users.
13061305

13071306
(((graceful degradation)))Try to think of a way the skill-sharing
13081307
website could be set up to preserve basic functionality when run

0 commit comments

Comments
 (0)