Skip to main content

Job Query Functions

Functions for querying the cron job registry. All imported from @evershop/evershop/lib/cronjob.

Import​

import {
getAllJobs,
getEnabledJobs,
getJob,
hasJob
} from '@evershop/evershop/lib/cronjob';

Functions​

getAllJobs​

getAllJobs(): Job[]

Returns all registered cron jobs (both enabled and disabled).

getEnabledJobs​

getEnabledJobs(): Job[]

Returns only jobs where enabled === true.

getJob​

getJob(jobName: string): Job | undefined

Returns a single job by its name.

hasJob​

hasJob(jobName: string): boolean

Checks if a job with the given name is registered.

Examples​

import { getEnabledJobs, hasJob } from '@evershop/evershop/lib/cronjob';

const jobs = getEnabledJobs();
console.log(`${jobs.length} cron jobs active`);

if (hasJob('sync-inventory')) {
console.log('Inventory sync job is registered');
}

See Also​