File tree Expand file tree Collapse file tree 3 files changed +13
-8
lines changed Expand file tree Collapse file tree 3 files changed +13
-8
lines changed Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
3
- // Task: implement a cancelable promise by passing `timeout: number`
4
- // as an option to the promisified function (last argument,
5
- // replacing the callback).
3
+ // Task: implement a cancelable promisify function.
4
+ // Allow passing new argument `timeout: number` after the last argument
5
+ // to the original function replacing the callback. The promisify should check
6
+ // the existence of timeout and apply logic to implement it on top of calling original function
7
+ // There is no need to propagate timeout to original function.
6
8
7
9
const promisify = ( fn ) => ( ...args ) => {
8
10
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 cancellation by passing `AbortSignal` as an option
4
- // to the promisified function (last argument, replacing the callback).
3
+ // Task: implement a cancelable promisify function with AbortController.
4
+ // Allow passing new argument `AbortSignal` after the last argument
5
+ // to the original function replacing the callback. The promisify should check
6
+ // the existence of timeout and apply logic to implement it on top of calling original function
7
+ // There is no need to propagate AbortSignal to original function.
5
8
// Hint: Create `AbortController` or `AbortSignal` in the usage section.
6
9
7
10
const promisify = ( fn ) => ( ...args ) => {
Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
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.
3
+ // Task: ensure all blocks of code in the usage section iterate in parallel
4
+ // on the same timer instance getting the same values. Currently, only the last block (of 3) works.
5
+ // Update the implementation of Timer so that all blocks can iterate concurrently using a single Timer instance.
6
6
7
7
class Timer {
8
8
#counter = 0 ;
You can’t perform that action at this time.
0 commit comments