UNPKG

@riddance/host

Version:

18 lines (17 loc) 760 B
import { Context, HandlerConfiguration } from './context.js'; import { type CronExpression } from './host/timer-registry.js'; export * from './context.js'; export type Timer = { readonly triggerTime: Date; }; export type TimerHandlerConfiguration = HandlerConfiguration & { /** * The TZ identifier identifying which time zone to the schedule is in, UTC if undefined. * @default undefined * @example 'America/Los_Angeles' */ readonly timezone?: string; }; export type Handler = (context: Context, when: Timer) => Promise<void> | void; export declare function setInterval(schedule: CronExpression, fn: Handler): void; export declare function setInterval(schedule: CronExpression, config: HandlerConfiguration, fn: Handler): void;