UNPKG

@tmlmobilidade/utils

Version:

A collection of utility functions and helpers for the TML Mobilidade Go monorepo, providing common functionality for batching operations, caching, HTTP requests, object manipulation, permissions, and more.

22 lines (21 loc) 801 B
import { type TimeSlot } from '@tmlmobilidade/dates'; interface RunOnIntervalOptions { /** * Interval in milliseconds between the end of one invocation * and the start of the next. The first invocation happens immediately. * @required */ intervalMs: number | TimeSlot; /** * Whether to throw errors after logging them. * If true, errors are logged and then re-thrown, stopping code execution. * @default false */ throwOnError?: boolean; } /** * Runs an asynchronous function at regular intervals, ensuring that each invocation * completes before the next one starts. Errors are logged and can optionally be re-thrown. */ export declare function runOnInterval(fn: () => Promise<void>, options: RunOnIntervalOptions): Promise<void>; export {};