Skip to content

Commit dbe7132

Browse files
authored
Updated: README.md
1 parent 71c98e4 commit dbe7132

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

  • L-A/0010 Design Cancellable Function (L-A)

L-A/0010 Design Cancellable Function (L-A)/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ generatorFunction = function*() {
3030
}
3131
cancelledAt = 100
3232
```
33-
**Output:** {"resolved": 42}
33+
**Output:** `{"resolved": 42}`<br>
3434
**Explanation:**
3535
```javascript
3636
const generator = generatorFunction();
@@ -50,7 +50,7 @@ generatorFunction = function*() {
5050
}
5151
cancelledAt = null
5252
```
53-
**Output:** {"rejected": "Error: Hello"}
53+
**Output:** `{"rejected": "Error: Hello"}`<br>
5454
**Explanation:**
5555
A promise is yielded. The function handles this by waiting for it to resolve and then passes the resolved value back to the generator. Then an error is thrown which has the effect of causing the promise to reject with the same thrown error.
5656

@@ -64,7 +64,7 @@ generatorFunction = function*() {
6464
}
6565
cancelledAt = 100
6666
```
67-
**Output:** {"rejected": "Cancelled"}
67+
**Output:** `{"rejected": "Cancelled"}`<br>
6868
**Explanation:**
6969
While the function is waiting for the yielded promise to resolve, cancel() is called. This causes an error message to be sent back to the generator. Since this error is uncaught, the returned promise rejected with this error.
7070

0 commit comments

Comments
 (0)