1.0.6 • Published 1 month ago

@elara-services/cron v1.0.6

Weekly downloads
-
License
ISC
Repository
github
Last release
1 month ago

Welcome to the cron package


Links:

Docs Docs

Discord Support

Patreon Patreon

PayPal PayPal


Getting Started

    const { CronClient } = require("@elara-services/cron");
    const client = new CronClient();
    // By default the timeZone will use `America/Los_Angeles`
    // OR 
    const client = new CronClient("TIMEZONE_HERE"); 
    // To have cron use a certain time to use.

Add Cron Job

    client.add({
        name: "dailyjob", // Name of the job
        time: "1 0 0 * * *", // Every day at midnight
        run: async () => {
            // Code to run when the time comes.
        },
        timeZone: "America/Los_Angeles", // The timeZone to use for this cronjob, otherwise it will use the default one (OPTIONAL)
        onStartup: true, // Run this job instantly (OPTIONAL, DEFAULT: false)
    });

Remove Cron Job

    client.remove("dailyjob"); // Remove the job and stop the process. 
    // Use the name of the cronjob when you created it.

Remove ALL Cron Jobs

    client.removeAll(); // Removes all cron jobs and stops the processes

View Cron Job

    const job = client.get("dailyjob");
    // use 'job' to view it's details etc.

List Cron Jobs

    const jobs = client.list();
    // Returns an array-object of the name and jobs 
1.0.6

1 month ago

1.0.4

3 months ago

1.0.3

3 months ago

1.0.2

3 months ago

1.0.1

3 months ago

1.0.0

3 months ago