Cancelable Async Functions with Generators
Learn how to use generators to create cancelable async functions.
We'll cover the following...
The cancelable
wrapper function is a big step ahead compared to embedding the cancelation logic directly in our code. However, it’s still not ideal for two reasons: it’s error prone (what if we forget to wrap one function?) and it still affects the readability of our code, which makes it not ideal for implementing cancelable asynchronous operations that are already large and complex.
Using generators
An even neater solution involves the use of generators. ...