Skip to content

v1.0.3 • Utils • 1kb gzipped • MIT

IdleTask

Schedule non-urgent work in idle time, with priorities and a deadline you can rely on.

★ 6.8kGitHub
↓ 11.6k / week● MIT● TS 5.0+
idletask-preview.png
Abstract preview graphic for IdleTask

// why idletask

Interaction stays first

Work yields back to the browser before the frame budget runs out, so scheduled tasks never cost you an input delay.

● 0 deps● 1kb gzipped● tree-shakeable

// stack

Priorities that mean something

Three levels, each with its own deadline, so background work cannot starve something a user is waiting on.

IdleTask started as a single file in a client project and stayed small on purpose. It does one job, it does it in 1kb gzipped, and it has no runtime dependencies.

Getting started

Install it, import it, call it:

npm i idletask-js

Work yields back to the browser before the frame budget runs out, so scheduled tasks never cost you an input delay.

What it does not do

It does not manage your state, style your components or ship a plugin system. Those are your decisions, and keeping them out is what keeps the bundle honest.

  • Frame-budget aware
  • Three priority lanes
  • MIT licensed, commercially friendly

Features

Frame-budget aware

Yields before the frame deadline instead of after it.

Three priority lanes

Urgent, normal and background, each with a distinct starvation guard.

Documented properly

Every public function has a worked example, not just a signature.

ESM and types

Ships module and CommonJS builds with hand-written type definitions and source maps.

Tree-shakes cleanly

Every export is side-effect free, so importing one function costs one function.

Tested to the edges

Ninety-eight percent branch coverage, with the awkward cases written first.

Get IdleTask v1.0.3

6 files • .min.js 1kb • .zip 94kb • sha384 verified

Changelog

v1.0.3 Oct 26 2025 • latest
  • Scheduler API used where available
  • Starvation guard for background lane
  • Now under 1kb
v1.0.2 Aug 28 2025
  • Fixed a memory leak on repeated teardown
  • Source maps now published with every build
v1.0.1 Jun 4 2025
  • Type definitions rewritten by hand
  • Dropped the last runtime dependency
View full archive →

// related

Related products

Sep 10 • v2.0

ChartForge

Canvas charts in twelve lines. Responsive, accessible and dark-mode ready, with no D3 learning curve.

View →
Aug 30 • v3.2.1

MotionEase

Physics-based micro-animations with a single call. Spring curves that feel right without a tuning session.

View →
Aug 19 • v1.9.4

FormFlow

Validation and multi-step logic that works the same in React, Vue and vanilla. Your markup stays yours.

View →

Drop it in this afternoon.

MIT licensed. Commercial friendly. Five-minute setup.