DigiNews

Tech Watch by Johan Denoyer

← Back to articles

You can't cancel a JavaScript promise (except sometimes you can)

Quality: 8/10 Relevance: 8/10

Summary

The article argues that native cancellation of JavaScript promises doesn’t exist and explores practical ways to interrupt async workflows. It covers approaches such as throwing an error, using generators for interruption, and the main technique of returning a never-resolving promise to pause execution. It also includes a detailed, runnable example from the Inngest SDK, discusses memory/garbage-collection considerations, and highlights tradeoffs between ergonomics and control flow.

🚀 Service construit par Johan Denoyer