Skip to content

Commit 37f6bf1

Browse files
committed
footnoterefs
1 parent 2f4272a commit 37f6bf1

File tree

7 files changed

+36
-36
lines changed

7 files changed

+36
-36
lines changed

chapters/ch01.asciidoc

Lines changed: 14 additions & 14 deletions
Large diffs are not rendered by default.

chapters/ch02.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ When you need to implicitly return an object literal, you'll need to wrap that o
332332
var objectFactory = () => ({ modular: 'es6' })
333333
----
334334
335-
In the following example, JavaScript interprets the curly braces as the body of our arrow function. Furthermore, `number` is interpreted as a labelfootnote:[Labels are used as a way of identifying instructions. Labels can be used by `goto` statements, to indicate what instruction we should jump to; `break` statements, to indicate the sequence we want to break out of; and `continue` statements, to indicate the sequence we want to advance. You can learn more about labels at: https://mjavascript.com/out/label.] and then figures out we have a `value` expression that doesn't do anything. Since we're in a block and not returning anything, the mapped values will be `undefined`.
335+
In the following example, JavaScript interprets the curly braces as the body of our arrow function. Furthermore, `number` is interpreted as a labelfootnoteref:[label,Labels are used as a way of identifying instructions. Labels can be used by `goto` statements, to indicate what instruction we should jump to; `break` statements, to indicate the sequence we want to break out of; and `continue` statements, to indicate the sequence we want to advance. You can learn more about labels at: https://mjavascript.com/out/label.] and then figures out we have a `value` expression that doesn't do anything. Since we're in a block and not returning anything, the mapped values will be `undefined`.
336336
337337
[source,javascript]
338338
----
@@ -1071,7 +1071,7 @@ var html = `<article>
10711071
</article>`
10721072
----
10731073

1074-
The template we've just prepared would produce output like what's shown in the following snippet of code. Note how spacing was preservedfootnote:[When using multi-line template literals, spacing isn't preserved automatically. However, in many cases we can provide just enough indentation to make it work. Be wary of indented code blocks which may result in undesired indentation due to our code block being nested.], and how `<li>` tags are properly indented thanks for how we joined them together using a few spaces.
1074+
The template we've just prepared would produce output like what's shown in the following snippet of code. Note how spacing was preservedfootnoteref:[multi-line-indentation,When using multi-line template literals, spacing isn't preserved automatically. However, in many cases we can provide just enough indentation to make it work. Be wary of indented code blocks which may result in undesired indentation due to our code block being nested.], and how `<li>` tags are properly indented thanks for how we joined them together using a few spaces.
10751075

10761076
[source,html]
10771077
----

chapters/ch03.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ Besides local symbols, there's also a global symbol registry, accessible from ac
527527

528528
==== 3.2.3 Global Symbol Registry
529529

530-
A code realm is any JavaScript execution context, such as the page your application is running in, an `<iframe>` within that page, a script running through `eval`, or a worker of any kind -- such as web workers, service workers, or shared workersfootnote:[Workers are a way of executing background tasks in browsers. The initiator can communicate with their workers, which run in a different execution context, via messaging. https://mjavascript.com/out/workers]. Each of these execution contexts has its own global object. Global variables defined on the `window` object of a page, for example, aren't available to a `ServiceWorker`. In contrast, the global symbol registry is shared across all code realms.
530+
A code realm is any JavaScript execution context, such as the page your application is running in, an `<iframe>` within that page, a script running through `eval`, or a worker of any kind -- such as web workers, service workers, or shared workersfootnoteref:[workers,Workers are a way of executing background tasks in browsers. The initiator can communicate with their workers, which run in a different execution context, via messaging. https://mjavascript.com/out/workers]. Each of these execution contexts has its own global object. Global variables defined on the `window` object of a page, for example, aren't available to a `ServiceWorker`. In contrast, the global symbol registry is shared across all code realms.
531531

532532
There's two methods that interact with the runtime-wide global symbol registry: `Symbol.for` and `Symbol.keyFor`. What do they do?
533533

@@ -771,7 +771,7 @@ Object.assign({}, { a: ['b', 'c', 'd'] }, { a: ['e', 'f'] })
771771
// <- { a: ['e', 'f'] }
772772
----
773773

774-
At the time of this writing, there's an ECMAScript stage 3 proposalfootnote:[You can find the proposal draft at: https://mjavascript.com/out/object-spread.] to implement spread in objects, similar to how you can spread iterable objects onto an array in ES6. Spreading an object onto another is equivalent to using an `Object.assign` function call.
774+
At the time of this writing, there's an ECMAScript stage 3 proposalfootnoteref:[object-spread,You can find the proposal draft at: https://mjavascript.com/out/object-spread.] to implement spread in objects, similar to how you can spread iterable objects onto an array in ES6. Spreading an object onto another is equivalent to using an `Object.assign` function call.
775775

776776
The following piece of code shows a few cases where we're spreading the properties of an object onto another one, and their `Object.assign` counterpart. As you can see, using object spread is more succint and should be preferred where possible.
777777

chapters/ch04.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ Here is an enumeration of what is going on as that piece of code is executed.
304304
8. The `p3` promise from `p2.catch` is fulfilled, because it doesn't produce an error or result in a rejected promise
305305
9. Because `p3` was fulfilled, the `p3.catch` is never followed. The `p3.then` branch would've been used instead
306306

307-
You should think of promises as a tree structure. This bears repetition: you should think of promises as a tree structurefootnote:[I wrote an online visualization tool called Promisees where you can see the tree structure underlying a Promise chain: https://mjavascript.com/out/promisees.].
307+
You should think of promises as a tree structure. This bears repetition: you should think of promises as a tree structurefootnoteref:[promisees,I wrote an online visualization tool called Promisees where you can see the tree structure underlying a Promise chain: https://mjavascript.com/out/promisees.].
308308

309309
image::../images/c04g04-promise-chain.png["Promisees can help us visualize how the fetch promise is fulfilled, but p2 is rejected, thus triggering any rejection reactions attached to it. Given p3 is fulfilled, rejection reactions like p4 are never executed."]
310310

@@ -438,7 +438,7 @@ Note that you can transform data in rejection branches as well. Keep in mind tha
438438

439439
==== 4.1.5 `Promise#finally` Proposal
440440

441-
There's a TC39 proposalfootnote:[This proposal is in stage 2 at the time of this writing. You can find the proposal draft at: https://mjavascript.com/out/proposal-promise-finally.] for a `Promise#finally` method, which would invoke a reaction when a promise settles, regardless of whether it was fulfilled or rejected.
441+
There's a TC39 proposalfootnoteref:[proposal-promise-finally,This proposal is in stage 2 at the time of this writing. You can find the proposal draft at: https://mjavascript.com/out/proposal-promise-finally.] for a `Promise#finally` method, which would invoke a reaction when a promise settles, regardless of whether it was fulfilled or rejected.
442442

443443
We can think of the following bit of code as a rough ponyfill for `Promise#finally`. We pass the reaction callback to `p.then` as both a fulfillment reaction and a rejection reaction.
444444

chapters/ch06.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ const proxy = concealWithPrefix(target)
181181
// expose proxy to consumers
182182
----
183183

184-
You might be tempted to argue that you could achieve the same behavior in ES5 simply by using variables privately scoped to the `concealWithPrefix` function, without the need for the `Proxy` itself. The difference is that proxies allow you to "privatize" property access dynamically. Without relying on `Proxy`, you couldn't mark every property that starts with an underscore as private. You could use `Object.freeze`footnote:[The `Object.freeze` method prevents adding new properties, removing existing ones, and modifying property value references. Note that it doesn't make the values themselves immutable: their properties can still change provided `Object.freeze` isn't called on those objects as well.] on the object, but then you wouldn't be able to modify the property references yourself, either. Or you could define get and set accessors for every property, but then again you wouldn't be able to block access on every single property, only the ones you explicitly configured getters and setters for.
184+
You might be tempted to argue that you could achieve the same behavior in ES5 simply by using variables privately scoped to the `concealWithPrefix` function, without the need for the `Proxy` itself. The difference is that proxies allow you to "privatize" property access dynamically. Without relying on `Proxy`, you couldn't mark every property that starts with an underscore as private. You could use `Object.freeze`​footnoteref:[object-freeze,The `Object.freeze` method prevents adding new properties, removing existing ones, and modifying property value references. Note that it doesn't make the values themselves immutable: their properties can still change provided `Object.freeze` isn't called on those objects as well.] on the object, but then you wouldn't be able to modify the property references yourself, either. Or you could define get and set accessors for every property, but then again you wouldn't be able to block access on every single property, only the ones you explicitly configured getters and setters for.
185185

186186
==== 6.1.3 Schema Validation with Proxies
187187

0 commit comments

Comments
 (0)