pinterval
    Preparing search index...

    Interface Params

    Interval parameters

    interface Params {
        func: IntervalFunction | IntervalFunctionAsync;
        onError?: ErrorHandler | ErrorHandlerAsync;
        signal?: AbortSignal;
        start?: StartMode;
        time: Duration;
    }
    Index

    Represents a function that operates on intervals. This function can be either synchronous or asynchronous.

    The callback receives an IntervalContext with the current iteration, elapsed run time, and effective cancellation signal.

    A callback function that handles errors during the execution of an operation. This function will be invoked whenever an error is encountered.

    • If an ErrorHandler is provided, it should be a synchronous function that processes the error immediately.

    • If an ErrorHandlerAsync is provided, it should be an asynchronous function capable of handling errors with asynchronous operations.

    signal?: AbortSignal

    An optional external signal that cancels the interval.

    The callback receives a run-owned signal that also aborts when stop() is called. Cancellation cannot forcibly interrupt arbitrary callback code, but signal-aware work can stop cooperatively.

    start?: StartMode

    Determines the initiation mode of a process. It can be set to either:

    • 'immediate': The process begins immediately without delay.
    • 'delayed': The process starts after the first delay.
    time: Duration

    Represents a duration of time. It can be either a number (milliseconds) or a function that returns a number based on the counter. Concrete and resolved values must be finite and between 0 and 2,147,483,647 milliseconds inclusive.