The runtime

The TypeScript runtime (JavaScript) has a concurrency model based on an event loop. This model is quite different to the models in other languages such as C or Java. Before we focus on the event loop itself, you must understand some runtime concepts.

What follows is a visual representation of some important runtime concepts: heap, stack, queue, and frame:

The runtime

We will now look at the role of each of these runtime concepts.


A frame is a sequential unit of work. In the preceding diagram, the frames are represented by the blocks inside the stack.

When a function is called in JavaScript, the runtime creates a frame in the stack. The frame ...

Get TypeScript: Modern JavaScript Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.