Skip to content

@forinda/kickjs-cron

Production-grade cron job scheduling with pluggable backends.

@Cron

typescript
function Cron(
  expression: string,
  options?: {
    description?: string
    timezone?: string
    runOnInit?: boolean
  },
): MethodDecorator

getCronJobs

typescript
function getCronJobs(target: any): CronJobMeta[]

interface CronJobMeta {
  expression: string
  handlerName: string
  description?: string
  timezone?: string
  runOnInit?: boolean
}

CronScheduler

typescript
interface CronScheduler {
  schedule(
    expression: string,
    callback: () => void | Promise<void>,
    options?: { timezone?: string },
  ): any
  stop(handle: any): void
  stopAll(): void
}

CronerScheduler

typescript
class CronerScheduler implements CronScheduler {
  constructor(cronerModule?: { Cron: any } | any)
  init(): Promise<void>
}

Requires croner peer dependency.

IntervalScheduler

typescript
class IntervalScheduler implements CronScheduler {}

Zero-dependency fallback using setInterval.

CronAdapter

typescript
class CronAdapter implements AppAdapter {
  constructor(options: CronAdapterOptions)
}

interface CronAdapterOptions {
  services: any[]
  enabled?: boolean
  scheduler?: CronScheduler
}

Released under the MIT License.