Reference

registerCleanup

Registers a disposer with the currently active cleanup scope and returns the owner's unregister handle when it provides one.

Signature

function registerCleanup(dispose: (): void): (): void | undefined