• Ensures a function is called only once

    Example

    const test = (msg) => console.log(msg);
    once(test, 'a'); // logs 'a'
    once(test, 'b'); // no log this time

    Type Parameters

    • Args extends unknown[]

    • Return

    • F extends ((...a: Args) => Return)

    Parameters

    • func: F
    • Rest ...args: Args

    Returns Return | void

Generated using TypeDoc