Skip to content

Commit

Permalink
fix: various typos (mdn#18483)
Browse files Browse the repository at this point in the history
  • Loading branch information
nschonni authored Jul 18, 2022
1 parent b5503b2 commit f453fe9
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ You have been provided with some raw HTML/CSS and a few text strings and JavaScr
- Generates a silly story when the "Generate random story" button is pressed.
- Replaces the default name "Bob" in the story with a custom name, only if a custom name is entered into the "Enter custom name" text field before the generate button is pressed.
- Converts the default US weight and temperature quantities and units in the story into UK equivalents if the UK radio button is checked before the generate button is pressed.
- Generates a new random silly story everytime the button is pressed.
- Generates a new random silly story every time the button is pressed.

The following screenshot shows an example of what the finished program should output:

Expand Down
2 changes: 1 addition & 1 deletion files/en-us/learn/javascript/objects/basics/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ person['name']['first']
This looks very similar to how you access the items in an array, and it is basically the same thing — instead of using an index number to select an item, you are using the name associated with each member's value.
It is no wonder that objects are sometimes called **associative arrays** — they map strings to values in the same way that arrays map numbers to values.

Dot notation is generally preferred over bracket notation because it is more succint and easier to read.
Dot notation is generally preferred over bracket notation because it is more succinct and easier to read.
However there are some cases where you have to use brackets.
For example, if an object property name is defined at runtime then you can't use dot notation to access the value, but you can pass the name as a variable inside brackets as shown with `input` below:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ tags:

## How-to's

1. [Accessiblity for frontend developers](https://accessibility.digital.gov/front-end/getting-started/)
1. [Accessibility for frontend developers](https://accessibility.digital.gov/front-end/getting-started/)

A brief guide from the U.S. General Services administration’s Technology Transformation Services covering several accessibility topics with links to "how-to" videos and to related WCAG references.

Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/readablestreambyobreader/read/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ browser-compat: api.ReadableStreamBYOBReader.read
{{APIRef("Streams")}}

The **`read()`** method of the {{domxref("ReadableStreamBYOBReader")}} interface is used to read data into a view on a user-supplied buffer from an associated [readable byte stream](/en-US/docs/Web/API/Streams_API/Using_readable_byte_streams).
A request for data will be statisfied from the stream's internal queues if there is any data present.
A request for data will be satisfied from the stream's internal queues if there is any data present.
If the stream queues are empty, the request may be supplied as a zero-copy transfer from the underlying byte source.

The method takes as an argument a view on a buffer that supplied data is to be read into, and returns a {{jsxref("Promise")}}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ This article explains how readable byte streams compare to normal "default" stre

> **Note:** Readable byte streams are almost identical to "normal" readable streams and almost all of the concepts are the same.
> This article assumes that you already understand those concepts and will only be covering them superficially (if at all).
> If you're not familiar with the relevent concepts, please first read: [Using readable streams](/en-US/docs/Web/API/Streams_API/Using_readable_streams), [Streams concepts and usage overview](/en-US/docs/Web/API/Streams_API#concepts_and_usage), and [Streams API concepts](/en-US/docs/Web/API/Streams_API/Concepts).
> If you're not familiar with the relevant concepts, please first read: [Using readable streams](/en-US/docs/Web/API/Streams_API/Using_readable_streams), [Streams concepts and usage overview](/en-US/docs/Web/API/Streams_API#concepts_and_usage), and [Streams API concepts](/en-US/docs/Web/API/Streams_API/Concepts).
## Overview

Expand Down Expand Up @@ -70,17 +70,17 @@ This live example shows how to create a readable byte stream with a _push_ under

Unlike with a pull underlying byte source, data can arrive at any time.
Therefore the underlying source must use `controller.byobRequest` to transfer incoming data if one exists, and otherwise enqueue the data into the stream's internal queues.
Further, since the data can arrive at any time the monitoring behaviour is set up in the `underlyingSource.start()` callback function.
Further, since the data can arrive at any time the monitoring behavior is set up in the `underlyingSource.start()` callback function.

The example is highly influenced by a push byte source example in the stream specification.
It uses a mocked "hypothetical socket" source that supplies data of arbitrary sizes.
The reader is deliberately delayed at various points to allow the underlying source to use both transfer and enqueing to send data to the stream.
The reader is deliberately delayed at various points to allow the underlying source to use both transfer and enqueuing to send data to the stream.
Backpressure support is not demonstrated.

> **Note:** An underlying byte source can also be used with a default reader.
> If automatic buffer allocation is enabled the controller will supply fixed-size buffers for zero-copy transfers when there is an outstanding request from a reader and the stream's internal queues are empty.
> If automatic buffer allocation is not enabled then all data from the byte stream will always be enqueued.
> This is similar to the behaviour shown in the "pull: underlying byte source examples.
> This is similar to the behavior shown in the "pull: underlying byte source examples.
#### Mocked underlying socket source

Expand Down Expand Up @@ -153,13 +153,13 @@ class MockHypotheticalSocket {
getNumberRandomBytesSocket() {
//Capped to remaining data and the max min return-per-read range
const remaining_data = this.max_data - this.data_read;
let numberBytesRecieved = 0;
let numberBytesReceived = 0;
if (remaining_data < this.min_per_read) {
numberBytesRecieved = remaining_data;
numberBytesReceived = remaining_data;
} else {
numberBytesRecieved = this.getRandomIntInclusive(this.min_per_read, Math.min(this.max_per_read, remaining_data));
numberBytesReceived = this.getRandomIntInclusive(this.min_per_read, Math.min(this.max_per_read, remaining_data));
}
return numberBytesRecieved;
return numberBytesReceived;
}

/* Return random number between two values */
Expand Down Expand Up @@ -253,9 +253,9 @@ This ensures that the stream is handed a {{domxref("ReadableByteStreamController

Since data can arrive at the socket before the consumer is ready to handle it, everything about reading the underlying source is configured in the `start()` callback method (we don't wait on a pull to start handling data).
The implementation opens the "socket" and calls `select2()` to request data.
When the retured promise resolves the code checks if `controller.byobRequest` exists (is not `null`), and if so calls `socket.readInto()` to copy data into the request and transfer it.
If `byobRequest` does not exist there is no outstanding request from a consuming stream that can be satisifed as as zero-copy transfer.
In this case, `constroller.enqueue()` used to copy data to the stream internal queues.
When the returned promise resolves the code checks if `controller.byobRequest` exists (is not `null`), and if so calls `socket.readInto()` to copy data into the request and transfer it.
If `byobRequest` does not exist there is no outstanding request from a consuming stream that can be satisfied as as zero-copy transfer.
In this case, `controller.enqueue()` used to copy data to the stream internal queues.

The `select2()` request for more data is reposted until a request is returned with no data.
A this point the controller is used to close the stream.
Expand Down Expand Up @@ -400,7 +400,7 @@ reader.closed
#### Result

The logging from the underlying push source (left) and consumer (right) are shown below.
Not the period in the middle where data is equeued rather than transferred as a zero-copy operation.
Not the period in the middle where data is enqueued rather than transferred as a zero-copy operation.

{{EmbedLiveSample("Underlying push source with default reader","100%","500px")}}

Expand Down Expand Up @@ -564,9 +564,9 @@ function makeReadableByteFileStream(filename) {
},
async pull(controller) {
// Called when there is a pull request for data
const theview = controller.byobRequest.view;
const theView = controller.byobRequest.view;
const {bytesRead, buffer} =
await fileHandle.read(theview.buffer, theview.offset, theview.length, position)
await fileHandle.read(theView.buffer, theView.offset, theView.length, position)
if (bytesRead === 0) {
await fileHandle.close();
controller.close();
Expand Down Expand Up @@ -787,9 +787,9 @@ function makeReadableByteFileStream(filename) {
},
async pull(controller) {
// Called when there is a pull request for data
const theview = controller.byobRequest.view;
const theView = controller.byobRequest.view;
const {bytesRead, buffer} =
await fileHandle.read(theview.buffer, theview.offset, theview.length, position)
await fileHandle.read(theView.buffer, theView.offset, theView.length, position)
if (bytesRead === 0) {
await fileHandle.close();
controller.close();
Expand Down Expand Up @@ -1002,8 +1002,8 @@ function makeReadableByteFileStream(filename) {
async pull(controller) {
// Called when there is a pull request for data
if (controller.byobRequest) {
const theview = controller.byobRequest.view;
const {bytesRead, buffer} = await fileHandle.read(theview.buffer, theview.offset, theview.length, position)
const theView = controller.byobRequest.view;
const {bytesRead, buffer} = await fileHandle.read(theView.buffer, theView.offset, theView.length, position)
if (bytesRead === 0) {
await fileHandle.close();
controller.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ It clones by recursing through the input object while maintaining a map of previ
<td><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error">Native <code>Error</code> types</a></td>
<td>
<p>The error name must be one of: {{jsxref("Error")}}, {{JSxRef("EvalError")}}, {{JSxRef("RangeError")}}, {{JSxRef("ReferenceError")}}, {{JSxRef("SyntaxError")}}, {{JSxRef("TypeError")}}, {{JSxRef("URIError")}} (or will be set to "Error").</p>
<p>Browsers must serialize the properties <code>name</code> and <code>message</code>, and are expected to serialise "interesting" other properties of the errors such as <code>stack</code>, <code>cause</code>, etc.</p>
<p>Browsers must serialize the properties <code>name</code> and <code>message</code>, and are expected to serialize "interesting" other properties of the errors such as <code>stack</code>, <code>cause</code>, etc.</p>
<p>{{JSxRef("AggregateError")}} support is expected to be added to the specification in <a href="https://github.com/whatwg/html/pull/5749">whatwg/html#5749</a> (and is already supported in some browsers).</p>
</td>
</tr>
Expand Down

0 comments on commit f453fe9

Please sign in to comment.