sust4in / chronos

Chronos Task Scheduler is a lightweight and easy-to-use task scheduling library for Deno, with support for both cron-based and interval-based scheduling. With Chronos, you can schedule and manage tasks in your Deno application with ease, ensuring that they run on time and as expected.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

chronos

Chronos - Task Scheduler

Chronos is a simple task scheduler library for Deno that allows you to schedule and run tasks at specific intervals or times.

Usage

Here's an example of how to use the Chronos Task Scheduler:

import {
  createTask,
  IntervalScheduler,
  Task,
} from "https://deno.land/x/chronos@v0.1.0/src/mod.ts";

// Define a task action
const taskAction = async () => {
  console.log("Task executed:", new Date());
};

// Create a task to be executed in 5 seconds
const dueTime = new Date(Date.now() + 5000);
const task = createTask("exampleTask", taskAction, dueTime, 1000);

// Create an IntervalScheduler instance
const scheduler = new IntervalScheduler();

// Schedule the task
scheduler.schedule(task);

// You can unschedule the task if necessary
scheduler.unschedule(task.id);

About

Chronos Task Scheduler is a lightweight and easy-to-use task scheduling library for Deno, with support for both cron-based and interval-based scheduling. With Chronos, you can schedule and manage tasks in your Deno application with ease, ensuring that they run on time and as expected.

License:MIT License


Languages

Language:TypeScript 100.0%