PingView component for checking online status using a ping function. Renders children when online, displays offline component when offline.

  • Type Parameters

    • P extends unknown = object

      Type parameter for the payload object passed to the ping function

    Parameters

    • props: IPingViewProps<P>

      The component props

      • ping

        The ping function to check online status

      • children

        The child components to render when online

      • onOnline

        Callback function to be called when online

      • onOffline

        Callback function to be called when offline

      • Offline

        The component to render when offline

      • fallback

        The fallback component to render when an error occurs

      • throwError

        Indicates if an error should be thrown when an error occurs during ping

      • delay

        The delay between consecutive pings (in milliseconds)

      • payload

        The payload object to be passed to the ping function

    Returns any

    • The rendered component or null if initialization is in progress