Skip to content

Commit 66ecd9a

Browse files
authored
Fix typos and improve grammar (#57)
1 parent 7b9c9a4 commit 66ecd9a

File tree

3 files changed

+26
-25
lines changed

3 files changed

+26
-25
lines changed

CODE_OF_CONDUCT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Code of Conduct
22

3-
All documentation, code and communication under this repository are covered by
3+
All documentation, code, and communication under this repository are covered by
44
the
55
[W3C Code of Ethics and Professional Conduct](https://www.w3.org/Consortium/cepc/).

asynclocalstorage.md

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The portable subset of `AsyncLocalStorage` defined here is offered as a
1414
transitional step in advance of `AsyncContext`. This subset is intentionally
1515
limited to a model and API that aligns closely with `AsyncContext`. Runtimes
1616
implementing async context tracking are strongly encouraged to implement only
17-
this subset in order to best remain forwards compatible with `AsyncContext`.
17+
this subset to best remain forwards compatible with `AsyncContext`.
1818

1919
## Logical model
2020

@@ -40,8 +40,10 @@ Whenever a new `frame` is created, it inherits a *copy* of the current
4040
`frame`'s `storage context` before setting the new `value` associated
4141
with the `storage key`.
4242

43-
In **pseudo-code**, this looks something like: (this is **NOT** the API,
44-
this is a pesudo-code illustration of the abstract model)
43+
In **pseudo-code**, this looks something like:
44+
45+
**Note**: this is **NOT** the API,
46+
this is a pseudo-code illustration of the abstract model.
4547

4648
```js
4749
class AsyncLocalStorage {
@@ -97,7 +99,7 @@ class AsyncContextFrame {
9799
Any async resource that is created needs only to grab the current `frame`
98100
and run code within its scope to access the correct `storage context`.
99101

100-
Note that key to this model is that the `storage context` is *immutable*
102+
Note that the key to this model is that the `storage context` is *immutable*
101103
once created. Mutations to the context using `asyncLocalStorage.run()`
102104
use copy-on-write semantics, causing a new `frame` to be created and
103105
entered. This is a key performance optimization over the current model
@@ -112,7 +114,7 @@ an asynchronous task is *scheduled*.
112114
* and so on
113115

114116
This is the general rule that runtimes and applications should follow for
115-
any api that schedules asynchronous tasks to run.
117+
any API that schedules asynchronous tasks to run.
116118

117119
## The API
118120

@@ -134,7 +136,7 @@ class AsyncLocalStorage {
134136
// In this subset, exit() is equivalent to calling `run(undefined, fn)`
135137
exit(fn, ...args) : any;
136138

137-
// Returns the value of store associated with this ALS instance
139+
// Returns the value of the store associated with this ALS instance
138140
// in the current frame's storage context.
139141
getStore() : any;
140142
}
@@ -146,7 +148,7 @@ The following is the limited subset of the `AsyncResource` API:
146148
147149
```js
148150
class AsyncResource {
149-
// The type and options here are defined by Node.js, with type
151+
// The type and options here are defined by Node.js, with the type
150152
// *currently* being required by Node.js. In this subset, the
151153
// type is still required but is *ignored*. It is required so
152154
// that code written to this subset can be portable to Node.js.
@@ -200,7 +202,7 @@ the async context `frame` is *mutable* in place. For instance, the
200202
Node.js `asyncLocalStorage.enterWith(...)` API modifies the `value`
201203
associated with `storage key` *in-place*, without creating and entering
202204
a new frame. Such a change is not scoped to just the current sync
203-
execution and can carry a number of side-effects.
205+
execution and can carry several side effects.
204206
205207
The `AsyncLocalStorage` subset defined in this document treats the
206208
async context frame as *immutable* once created and therefore does
@@ -215,12 +217,12 @@ not included in this subset.
215217
216218
In general terms, an "async resource" is any task that is expected
217219
to capture the current async context frame and run within its scope
218-
at some point in the future. There are some async resources built in
219-
to JavaScript (e.g. promises, thenables, and microtasks), some defined
220+
at some point in the future. There are some async resources built into
221+
JavaScript (e.g. promises, thenables, and microtasks), some defined
220222
by Web Platform APIs (e.g. timers, background tasks, unhandled rejections),
221-
some defined by the runtime, and others defined by the application. The
222-
common characterist of all async resources is that they are expected to
223-
capture the current async context frame and propagate it at various
223+
some defined by the runtime, and others defined by the application.
224+
A common characteristic of all async resources is that they are expected
225+
to capture the current async context frame and propagate it at various
224226
specific times.
225227
226228
### Promises
@@ -238,7 +240,6 @@ the promise is created rather than when the continuation task is created.
238240
actively discussed. We *could* end up with a model similar to Node.js' in the
239241
end but there's still a lot of uncertainty here***
240242
241-
242243
#### Thenables
243244
244245
Thenables (promise-like objects that expose a `then()` method) should be handled
@@ -266,13 +267,13 @@ function within the context of that frame.
266267
267268
As described previously, async context should be captured at the moment
268269
an asynchronous task is *scheduled*. This is the general rule that runtimes
269-
and applications should follow for any api that schedules asynchronous tasks
270+
and applications should follow for any API that schedules asynchronous tasks
270271
to run.
271272
272273
For example, imagine an API that processes a stream of data by calling
273-
a set of configured callbacks. The context that is propagate to each of
274+
a set of configured callbacks. The context that is propagated to each of
274275
the callbacks should be the context that is current when the processing
275-
it *started*.
276+
*started*.
276277
277278
```js
278279
const als = new AsyncLocalStorage();
@@ -293,7 +294,7 @@ Here, the call to `processor.start(data)` actually schedules the async
293294
activity, so that is the context that is propagated by default. If,
294295
alternatively, the intent is for the callbacks to run within the
295296
context that is current when the `Processor` instance is created,
296-
`AsyncResource.bind()` should be used, of the `Processor` can extend
297+
`AsyncResource.bind()` should be used, if the `Processor` can extend
297298
`AsyncResource` and use `this.runInAsyncScope()`.
298299
299300
```js
@@ -313,7 +314,7 @@ als.run(123, () => processor.start(data));
313314
314315
`EventTarget` and `EventEmitter` are slightly different cases. Events
315316
are *technically not* asynchronous tasks. Both EventTarget and
316-
EventEmitter dispatch events fully sychronously so they will always
317+
EventEmitter dispatch events fully synchronously so they will always
317318
run in the same context frame as the dispatchEvent/emit call.
318319
319320
```js
@@ -331,7 +332,7 @@ als.run(321, () => {
331332
});
332333
```
333334
334-
For force an event listener to use the context frame that is current
335+
To force an event listener to use the current context frame
335336
when the listener is added, use `AsyncResource.bind()`:
336337
337338
```js
@@ -401,14 +402,14 @@ is `321`. Within the implementation of `reject()`, the internal machinery
401402
will determine if the rejection is handled. If it is not, that machinery
402403
will *schedule* the asynchronous dispatch of an `unhandledrejection` event.
403404
The current async context must be captured *at that point* and restored
404-
when the 'unhandledrejection` event is actually dispatched.
405+
when the `unhandledrejection` event is dispatched.
405406
406407
When the promise rejection handler is attached inside the `unhandledrejection`
407408
event listener, prompting a subsequent dispatch of the `rejectionhandled`
408409
event, the value of `als.getStore()` is 'abc', which is propagated to the
409410
`rejectionhandled` event when it is dispatched.
410411
411-
If someone really wants the `unhandledrejection` event to receive the
412+
If someone wants the `unhandledrejection` event to receive the
412413
context at the time the promise was created, then the `reject()` should be
413414
wrapped using `AsyncResource.bind()`, for instance:
414415

index.bs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ While this term is intentionally broad to also encompass Web Browsers, the prima
3333
Common API Index {#index}
3434
=========================
3535

36-
All <a>Web-interoperable Runtimes</a> conforming to this specification SHALL implement each of the following Web Platform APIs in accordance to their normative requirements except where modified here. Where any conforming runtime environment chooses (either by necessity or otherwise) to diverge from a normative requirement of the specification, clear explanations of such divergence MUST be made clearly and readily available in documentation.
36+
All <a>Web-interoperable Runtimes</a> conforming to this specification SHALL implement each of the following Web Platform APIs in accordance with their normative requirements except where modified here. Where any conforming runtime environment chooses (either by necessity or otherwise) to diverge from a normative requirement of the specification, clear explanations of such divergence MUST be made clearly and readily available in the documentation.
3737

3838
Interfaces:
3939

@@ -117,7 +117,7 @@ Requirements for navigator.userAgent
117117
====================================
118118

119119
The globalThis.{{navigator}}.{{userAgent}} property is provided such that application code can reliably identify the runtime within which it is running.
120-
The value of the property is a string conforming to the the <code class="idl"><a data-link-type="idl" href="https://datatracker.ietf.org/doc/html/rfc7231#section-5.5.3">`User-Agent`</a></code> construction in RFC 7231:
120+
The value of the property is a string conforming to the <code class="idl"><a data-link-type="idl" href="https://datatracker.ietf.org/doc/html/rfc7231#section-5.5.3">`User-Agent`</a></code> construction in RFC 7231:
121121

122122
<pre>
123123
User-Agent = product *( RWS ( product / comment ) )

0 commit comments

Comments
 (0)