Loading topic
addEventListener. It introduces the two objects that every later chapter builds on. Later chapters look closely at the signal's properties and its event.2 min readAbortController and call abort() on it. It also assumes you know promises and try/catch. Here you will learn the two properties every cancellable function reads first: signal.aborted and signal.reason.2 min readaddEventListener works, how closures capture variables, and the basics from the previous chapters: an AbortController owns a signal, and signal.aborted and signal.reason describe its state. Reading those properties tells you whether cancellation has happened2 min read?.), and the basic split between AbortController and AbortSignal from the earlier chapters. The goal is to choose a function signature that callers will recognize as soon as they see it.2 min readsignal.aborted, signal.reason, the abort event, and the { signal } options convention.2 min readnew Promise((resolve, reject) => ...), how setTimeout and clearTimeout work, and the material from earlier chapters: signal.aborted, signal.reason, the abort event, and the early-abort check.2 min readabort event and the cancellable delay() function. You should also be comfortable with closures and promises.2 min readfor...of loops, and try/catch. It also assumes you have read the earlier chapters on signal.aborted, signal.reason, and the { signal } options convention.2 min readfetch, and that you have read the earlier chapters on the signal option and on throwIfAborted(). Its subject is propagation: when your function calls other cancellable functions, it passes the caller's signal down to them so that a single abort rea2 min readAbortController, read signal.aborted, and reject a promise with signal.reason. Here we look at what that reason actually is, because callers rely on it to decide what happened.2 min readtry/catch, async/await, and the AbortError and TimeoutError names from the previous chapter. Earlier chapters covered the function side. Here you write the code that calls a cancellable function and decides what a rejection means.2 min readdelay() from earlier chapters, and that you know how to tell an AbortError apart from other errors in a catch block. Here you will add a deadline. A deadline is a cancellation source that fires on its own once a set time has passed, with no2 min readAbortSignal.timeout() creates a deadline signal. It also assumes you know how callers tell AbortError apart from TimeoutError. Here you will combine that deadline with a signal the caller passes in, so your function stops at whichever comes first.2 min readaddEventListener and have built cancellable functions with an AbortController, as in the earlier chapters. You will use the same signal to remove event listeners, so a function that subscribes to events can be cancelled like any other cancellable function.2 min readnode:test) and node:assert, and that you have the cancellable delay() from earlier chapters. A cancellable function has more than one way to finish, and each one needs its own test. A happy-path test alone won't show that cancellati2 min read