Function normalizedTimeoutCallback

  • Launch a function in a certain amount of time If the delay argument is zero, the callback will be launched synchronously

    Parameters

    • callback: Function
    • delay: number

    Returns {
        clear: (() => void);
    }

    • clear: (() => void)
        • (): void
        • Returns void

    Example

    normalizedTimeoutCallback(callback, 1000);
    normalizedTimeoutCallback(callback, 0); // synchronous, without delay