Zero dependencies · Node + browser

Newest work goes first.

easy-stack is a small cooperative LIFO runner for priority work, staged requests, and flows where the most recently added task should execute next. It works with bundlers and without a bundler: bundlers resolve the package name normally, while native browser ESM uses an import map with no build or transpilation step.

npm install easy-stack
easy-stack wordmark beside a glowing stack whose newest amber layer is on top

The execution contract

Small surface. Explicit control.

The v2.1 package keeps the original cooperative model, removes WeakMap overhead, and gives native ESM and CommonJS one shared Node implementation.

01

Strictly LIFO

The most recently added callback is always the next callback selected.

02

Cooperative

Each callback decides when the flow continues by calling this.next().

03

Synchronous start

With auto-run enabled, the first eligible task begins before add() returns.

04

Recoverable

A thrown callback error returns the runner to idle without swallowing the error.