Reading 15: Promises
We start at the highest level, with the promise abstraction, and the await operator and async function declaration that allow concurrent computations to happen in TypeScript in a way that closely resembles familiar synchronous programming. Then we will dig below the covers to understand more about what is really happening with Promise, await, and async. A promise represents a concurrent computation that has been started but might still be unfinished, whose result may not be ready yet. The name comes from the notion that it is a promise to finish the computation and provide a result sometime in the future. The Promise type in TypeScript is generic: a Promise<T> represents a concurrent computation that at some point should produce a value of type T. Here are examples of concurrent computations using promises. (Some of these are actual functions provided by Node packages; others don’t currently exist as library functions but could be readily implemented.) Importantly, each of these functi
Reading 15: Promises Reading 15: Promises Software in 6.102 Safe from bugs Easy to understand Ready for change Correct today and correct in the unknown future. Communicating clearly with future programmers, including future you. Designed to accommodate change without rewriting. Objectives This reading discusses concurrent computation using promises . We start at the highest level, with the promise abstraction, and the await operator and async function declaration that allow concurrent computations to happen in TypeScript in a way that closely resembles familiar synchronous programming. Then we
Explore this link on the map →saved by
related reading
- Reading 16: Mutual Exclusionweb.mit.edu
- TypeScript Structured Concurrencythecandidstartup.org
- Reading 14: Concurrencyweb.mit.edu
- Reading 13: Map, Filter, Reduceweb.mit.edu
- Reading 18: Message-Passing and Networkingweb.mit.edu
- What Async Promised and What it Delivered — Causalitycausality.blog
- Futures and promises - Wikipediaen.wikipedia.org
- Problem Set 4: Memory Scrambleweb.mit.edu
- Reading 17: Callbacks and Graphical User Interfacesweb.mit.edu
- Microtasks and event looptr.javascript.info
- JavaScript Async Promisesw3schools.com
- Promise - JavaScript | MDNdeveloper.mozilla.org