This commit is contained in:
Boki 2025-06-22 17:55:51 -04:00
parent d858222af7
commit 7d9044ab29
202 changed files with 10755 additions and 10972 deletions

View file

@ -9,7 +9,12 @@ import type { ShutdownResult } from './types';
// Core shutdown classes and types
export { Shutdown } from './shutdown';
export type { ShutdownCallback, ShutdownOptions, ShutdownResult, PrioritizedShutdownCallback } from './types';
export type {
ShutdownCallback,
ShutdownOptions,
ShutdownResult,
PrioritizedShutdownCallback,
} from './types';
// Global singleton instance
let globalInstance: Shutdown | null = null;
@ -31,7 +36,11 @@ function getGlobalInstance(): Shutdown {
/**
* Register a cleanup callback that will be executed during shutdown
*/
export function onShutdown(callback: () => Promise<void> | void, priority?: number, name?: string): void {
export function onShutdown(
callback: () => Promise<void> | void,
priority?: number,
name?: string
): void {
getGlobalInstance().onShutdown(callback, priority, name);
}

View file

@ -8,7 +8,12 @@
* - Platform-specific signal support (Windows/Unix)
*/
import type { PrioritizedShutdownCallback, ShutdownCallback, ShutdownOptions, ShutdownResult } from './types';
import type {
PrioritizedShutdownCallback,
ShutdownCallback,
ShutdownOptions,
ShutdownResult,
} from './types';
// Global flag that works across all processes/workers
declare global {