File tree Expand file tree Collapse file tree 4 files changed +12
-13
lines changed Expand file tree Collapse file tree 4 files changed +12
-13
lines changed Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
3
- // Task: implement cancel passing `timeout` as an option
4
- // to promisified function (last argiment instead of callback)
3
+ // Task: implement a cancelable promise by passing `timeout: number`
4
+ // as an option to the promisified function (last argument,
5
+ // replacing the callback).
5
6
6
7
const promisify = ( fn ) => ( ...args ) => {
7
8
const promise = new Promise ( ( resolve , reject ) => {
Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
3
- // Task: implement cancel passing `AbortSignal` as an option
4
- // to promisified function (last argiment instead of callback)
5
- // Hint: create `AbortController` or `AbortSignal` in usage section
3
+ // Task: implement cancellation by passing `AbortSignal` as an option
4
+ // to the promisified function (last argument, replacing the callback).
5
+ // Hint: Create `AbortController` or `AbortSignal` in the usage section.
6
6
7
7
const promisify = ( fn ) => ( ...args ) => {
8
8
const promise = new Promise ( ( resolve , reject ) => {
Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
3
- // Task: In usage section we have 3 blocks of code (in iife wrappers)
4
- // with async iterators generated from single `Timer` instance.
5
- // The prombem is: first and second blocks does not iterate,
6
- // just last one works as of now. Fix this to allow all blocks iterate
7
- // in parallel.
3
+ // Task: ensure all blocks of code in the usage section iterate in parallel.
4
+ // Currently, only the last block (of 3) works. Fix this issue so that
5
+ // all blocks can iterate concurrently using a single `Timer` instance.
8
6
9
7
class Timer {
10
8
#counter = 0 ;
Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
3
- // Task: refactor `Timer` to make event name (`step` in example)
4
- // configurable ( not hardcoded into `Timer`)
5
- // Hint: you need Node.js >= v19.0.0
3
+ // Task: refactor `Timer` to make the event name configurable
4
+ // (e.g., 'step' in the example) and not hardcoded into the `Timer`.
5
+ // Hint: You need Node.js >= v19.0.0
6
6
7
7
class Timer extends EventTarget {
8
8
#counter = 0 ;
You can’t perform that action at this time.
0 commit comments