Skip to main content

Function: resolveCleanupHandler()

resolveCleanupHandler(cleanupCandidate: unknown, handlers: CleanupResolutionHandlers): () => void

Defined in: src/services/utils/cleanupHandlers.ts:87

Normalizes a cleanup candidate into a callable cleanup function.

Parametersโ€‹

cleanupCandidateโ€‹

unknown

Value produced by the preload bridge when registering a subscription.

handlersโ€‹

CleanupResolutionHandlers

Hooks used to react to invalid cleanup values or cleanup failures.

Returnsโ€‹

A cleanup function that is safe for callers to invoke regardless of the original cleanup candidate shape.

(): void

Returnsโ€‹

void

Remarksโ€‹

When the preload bridge returns something other than a function the CleanupResolutionHandlers.handleInvalidCleanup hook decides how to proceed. Otherwise the returned function is wrapped so any cleanup failure is forwarded to CleanupResolutionHandlers.handleCleanupError without breaking the caller's control flow.