scheduler-yield

Installation
SKILL.md

Use scheduler.yield() to keep the main thread responsive during long tasks

Any JavaScript task longer than 50 ms blocks the browser's main thread, preventing it from processing clicks, keyboard events, and rendering frames. Yielding between chunks of work keeps Interaction to Next Paint (INP) low and makes the page feel responsive even during heavy computation.

Quick Reference

  • Tasks longer than 50 ms block input and hurt Interaction to Next Paint (INP)
  • scheduler.yield() pauses execution, lets the browser handle queued input, then resumes
  • Use a MessageChannel-based polyfill where scheduler.yield() is unavailable
  • Apply to data processing loops, tree traversals, and bulk DOM mutations

Check

Identify synchronous loops, recursive traversals, or bulk operations in this code that could run for more than 50 ms and block user input.

Fix

Refactor long synchronous tasks to yield to the browser between chunks using scheduler.yield() with a MessageChannel fallback.

Installs
4
GitHub Stars
73.9K
First Seen
Aug 11, 2026
scheduler-yield — thedaviddias/front-end-checklist