• Tries to get the value of a callback function.

    If the callback function throws an error, it will return undefined.

    The is intended to be used with callbacks that might throw errors, and you don't want to handle the error.

    Type Parameters

    • T

      The type of the value returned by the callback function.

    Parameters

    • callbackfn: () => T

      The callback function to try to get the value of.

    Returns T

    The value of the callback function, or undefined if the callback function threw an error.