Skip to content

@pawanmkr/fucron

Pre-release
Pre-release

Choose a tag to compare

@pawanmkr pawanmkr released this 21 Jun 14:07

Features

  • In-Memory One-Time Task Scheduling
    Schedule delayed, one-off tasks using a Promise-based API built on top of native setTimeout.

  • Task Tracking & Management
    All scheduled tasks are tracked internally, allowing inspection of pending tasks and cancellation before execution.

  • Simple API

    • schedule(callback, delayMs): Schedule a task to run after a delay.
    • unschedule(taskId): Cancel a scheduled task.
    • pending(): Get the number of currently scheduled (pending) tasks.
  • TypeScript Support
    Written in modern TypeScript for type safety and developer ergonomics.

Usage Example

import { scheduler } from "@pawanmkr/fucron";

const taskId = await scheduler.schedule(() => {
    console.log("Task executed after 5s");
}, 5000);

scheduler.unschedule(taskId);
console.log("Pending:", scheduler.pending());

Note: All scheduling is in-memory only. Tasks are lost on process restart. Not intended for persistent or recurring jobs.