Search⌘ K
AI Features

Exercise: Deep Async Cancelable

Explore how to extend asynchronous cancelable tasks in Node.js by implementing nested cancelable functions. Learn to manage cancellation of main and nested async operations using generator functions and promises. This lesson deepens your understanding of advanced async control and error handling.

Problem statement

Extend the createAsyncCancelable() function so that it’s possible to invoke other cancelable functions from within the main cancelable function. Canceling the main operation should also cancel all nested operations.

If you’re unsure about how to do this, click the “Show Hint” button.

Coding challenge

Write your solution code in the following code widget. We’ve already added the package.json file for your ease.

Node.js
// Write your code here

Solution

...