@intlayer/chokidar
Version:
Uses chokidar to scan and build Intlayer declaration files into dictionaries based on Intlayer configuration.
24 lines • 947 B
TypeScript
/**
* Ensures a callback function runs only once within a specified time window across multiple processes.
* Uses a sentinel file to coordinate execution and prevent duplicate work.
*
* @param sentinelFilePath - Path to the sentinel file used for coordination
* @param callback - The function to execute (should be async)
* @param cacheTimeoutMs - Time window in milliseconds during which the sentinel is considered valid (default: 60000ms = 1 minute)
*
* @example
* ```typescript
* await runPrepareIntlayerOnce(
* '/tmp/intlayer-sentinel',
* async () => {
* // Your initialization logic here
* await prepareIntlayer();
* },
* 30 * 1000 // 30 seconds cache
* );
* ```
*
* @throws {Error} When there are unexpected filesystem errors
*/
export declare const runOnce: (sentinelFilePath: string, callback: () => void | Promise<void>, cacheTimeoutMs?: number) => Promise<void>;
//# sourceMappingURL=runOnce.d.ts.map