@paroicms/internal-server-lib
Version:
Common utilitaries for the paroicms server.
15 lines (14 loc) • 531 B
TypeScript
import type { BasicAppLogger } from "./public.types.js";
export interface CronLikeOptions {
shouldExecute: ShouldExecuteFn;
immediate?: boolean;
logger: BasicAppLogger;
}
export type ShouldExecuteFn = (lastTime: Date) => boolean;
/**
* @returns A function to stop the cron-like process.
*/
export declare function startCronLike(task: () => Promise<void>, { shouldExecute, immediate, logger }: CronLikeOptions): () => Promise<void>;
export declare function eachDay({ hours }: {
hours: number;
}): ShouldExecuteFn;