Skip to content

Commit 88aef0b

Browse files
committed
susy210512
2 parents 8501f4f + 6ab384f commit 88aef0b

9 files changed

Lines changed: 23 additions & 15 deletions

File tree

1-js/04-object-basics/04-object-methods/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ user = {
8181
// la forma abreviada se ve mejor, ¿verdad?
8282
user = {
8383
*!*
84-
sayHi() { // igual que "sayHi: function()"
84+
sayHi() { // igual que "sayHi: function(){...}"
8585
*/!*
8686
alert("Hello");
8787
}

1-js/05-data-types/08-weakmap-weakset/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# WeakMap y WeakSet
22

3-
Como sabemos por el capítulo <info:garbage-collection>, el motor de JavaScript almacena un valor en la memoria mientras es accesible (y puede ser potencialmente usado).
3+
Como sabemos por el capítulo <info:garbage-collection>, el motor de JavaScript mantiene un valor en la memoria mientras sea accesible (potencialmente usable).
44

55
Por ejemplo:
66
```js

1-js/11-async/02-promise-basics/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Cuando el ejecutor obtiene el resultado, ya sea pronto o tarde, no importa, debe
3131
- `resolve(value)` - si el trabajo finalizó con éxito, con el resultado `value`.
3232
- `reject(error)` - si ocurrió un error, `error` es el objeto error.
3333

34-
Para resumir: el ejecutor corre automáticamente e intenta realizar una tarea. Cuando termina con el intento, llama a 'resolve' si fue exitoso o 'reject' si hubo un error.
34+
Para resumir: el ejecutor corre automáticamente e intenta realizar una tarea. Cuando termina con el intento, llama a `resolve` si fue exitoso o `reject` si hubo un error.
3535

3636
El objeto `promise` devuelto por el constructor `new Promise` tiene estas propiedades internas:
3737

1-js/11-async/07-microtask-queue/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Los controladores de promesas siempre pasan por esta cola interna.
4040

4141
Si hay una cadena con múltiples `.then/catch/finally`, entonces cada uno de ellos se ejecuta de forma asincrónica. Es decir, primero se pone en la cola, luego se ejecuta cuando se completa el código actual y se finalizan los controladores previamente en la cola.
4242

43-
**¿Qué pasa si lo que estamos pidiendo es importante? ¿Cómo podemos hacer que `código finalizado` se ejecute después de `¡promesa realizada!`?**
43+
**¿y si el orden es importante para nosotros? ¿Cómo podemos hacer que `código finalizado` se ejecute después de `¡promesa realizada!`?**
4444

4545
Fácil, solo ponlo en la cola con `.then`:
4646

1-js/12-generators-iterators/2-async-iterators-generators/article.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,8 @@ Un ejemplo de uso (muestra autores de commit en la consola):
384384
}
385385
386386
})();
387+
388+
// Nota: Si ejecutas este código en una caja de pruebas externa, necesitas copiar aquí la función fetchCommits descrita más arriba
387389
```
388390

389391
Eso es justo lo que queríamos.

2-ui/1-document/03-dom-navigation/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ alert( document.body.previousSibling ); // HTMLHeadElement
214214

215215
## Navegación solo por elementos
216216

217-
Las propiedades de navegación enumeradas abajo se refieren a *todos* los nodos. Por ejemplo, en `childNodes` podemos ver ambos nodos de texto, nodos elementos, e incluso si existen los nodos de comentarios.
217+
Las propiedades de navegación enumeradas abajo se refieren a *todos* los nodos. Por ejemplo, en `childNodes` podemos ver nodos de texto, nodos elementos; y si existen, incluso los nodos de comentarios.
218218

219219
Pero para muchas tareas no queremos los nodos de texto o comentarios. Queremos manipular el nodo que representa las etiquetas y formularios de la estructura de la página.
220220

2-ui/1-document/10-size-and-scroll-window/article.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ alert('Desplazamiento actual desde la parte izquierda: ' + window.pageXOffset);
7373

7474
Estas propiedades son de solo lectura.
7575

76+
```smart header="También disponible como propiedades `window`: `scrollX` y `scrollY`"
77+
Por razones históricas existen ambas propiedades pero ambas son lo mismo:
78+
- `window.pageXOffset` es un alias de `window.scrollX`.
79+
- `window.pageYOffset` es un alias de `window.scrollY`.
80+
```
81+
7682
## Desplazamiento: scrollTo, scrollBy, scrollIntoView [#window-scroll]
7783
7884
```warn

4-binary/03-blob/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ let context = canvas.getContext('2d');
186186
context.drawImage(img, 0, 0);
187187
// podemos hacer un context.rotate(), y muchas otras cosas en canvas
188188

189-
// toBlob es una operación sincrónica, callback es llamada al terminar
189+
// toBlob es una operación asincrónica, callback es llamada al terminar
190190
canvas.toBlob(function(blob) {
191191
// blob listo, descárgalo
192192
let link = document.createElement('a');

6-data-storage/03-indexeddb/article.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ openRequest.onupgradeneeded = function(event) {
9595
};
9696
```
9797

98-
Please note: as our current version is `2`, `onupgradeneeded` handler has a code branch for version `0`, suitable for users that are accessing for the first time and have no database, and also for version `1`, for upgrades.
98+
Please note: as our current version is `2`, the `onupgradeneeded` handler has a code branch for version `0`, suitable for users that are accessing for the first time and have no database, and also for version `1`, for upgrades.
9999

100100
And then, only if `onupgradeneeded` handler finishes without errors, `openRequest.onsuccess` triggers, and the database is considered successfully opened.
101101

@@ -156,7 +156,7 @@ openRequest.onsuccess = function() {
156156
openRequest.onblocked = function() {
157157
// this event shouldn't trigger if we handle onversionchange correctly
158158

159-
// it means that there's another open connection to same database
159+
// it means that there's another open connection to the same database
160160
// and it wasn't closed after db.onversionchange triggered for it
161161
};
162162
*/!*
@@ -171,7 +171,7 @@ We can handle things more gracefully in `db.onversionchange`, prompt the visitor
171171

172172
Or, an alternative approach would be to not close the database in `db.onversionchange`, but instead use the `onblocked` handler (in the new tab) to alert the visitor, tell him that the newer version can't be loaded until they close other tabs.
173173

174-
These update collisions happen rarely, but we should at least have some handling for them, at least `onblocked` handler, to prevent our script from dying silently.
174+
These update collisions happen rarely, but we should at least have some handling for them, at least an `onblocked` handler, to prevent our script from dying silently.
175175

176176
## Object store
177177

@@ -189,7 +189,7 @@ An example of an object that can't be stored: an object with circular references
189189

190190
**There must be a unique `key` for every value in the store.**
191191

192-
A key must be one of the these types - number, date, string, binary, or array. It's a unique identifier, so we can search/remove/update values by the key.
192+
A key must be one of these types - number, date, string, binary, or array. It's a unique identifier, so we can search/remove/update values by the key.
193193

194194
![](indexeddb-structure.svg)
195195

@@ -253,7 +253,7 @@ db.deleteObjectStore('books')
253253

254254
The term "transaction" is generic, used in many kinds of databases.
255255

256-
A transaction is a group operations, that should either all succeed or all fail.
256+
A transaction is a group of operations, that should either all succeed or all fail.
257257

258258
For instance, when a person buys something, we need to:
259259
1. Subtract the money from their account.
@@ -347,9 +347,9 @@ Usually, we can assume that a transaction commits when all its requests are comp
347347

348348
So, in the example above no special call is needed to finish the transaction.
349349

350-
Transactions auto-commit principle has an important side effect. We can't insert an async operation like `fetch`, `setTimeout` in the middle of transaction. IndexedDB will not keep the transaction waiting till these are done.
350+
Transactions auto-commit principle has an important side effect. We can't insert an async operation like `fetch`, `setTimeout` in the middle of a transaction. IndexedDB will not keep the transaction waiting till these are done.
351351

352-
In the code below, `request2` in line `(*)` fails, because the transaction is already committed, and can't make any request in it:
352+
In the code below, `request2` in the line `(*)` fails, because the transaction is already committed, and can't make any request in it:
353353

354354
```js
355355
let request1 = books.add(book);
@@ -370,7 +370,7 @@ That's because `fetch` is an asynchronous operation, a macrotask. Transactions a
370370

371371
Authors of IndexedDB spec believe that transactions should be short-lived. Mostly for performance reasons.
372372

373-
Notably, `readwrite` transactions "lock" the stores for writing. So if one part of application initiated `readwrite` on `books` object store, then another part that wants to do the same has to wait: the new transaction "hangs" till the first one is done. That can lead to strange delays if transactions take a long time.
373+
Notably, `readwrite` transactions "lock" the stores for writing. So if one part of the application initiated `readwrite` on `books` object store, then another part that wants to do the same has to wait: the new transaction "hangs" till the first one is done. That can lead to strange delays if transactions take a long time.
374374

375375
So, what to do?
376376

@@ -792,7 +792,7 @@ await inventory.add({ id: 'js', price: 10, created: new Date() }); // Error
792792

793793
The next `inventory.add` after `fetch` `(*)` fails with an "inactive transaction" error, because the transaction is already committed and closed at that time.
794794

795-
The workaround is same as when working with native IndexedDB: either make a new transaction or just split things apart.
795+
The workaround is the same as when working with native IndexedDB: either make a new transaction or just split things apart.
796796
1. Prepare the data and fetch all that's needed first.
797797
2. Then save in the database.
798798

0 commit comments

Comments
 (0)