geoview-core
    Preparing search index...

    Function whenThisThenThat

    • This generic function checks for a validity of something via the checkCallback() until it's found or until the timer runs out. When the check callback returns true (or some found object), the doCallback() function is called with the found information. If checkCallback wasn't found and timer expired, the failCallback() function is called.

      Type Parameters

      • T

      Parameters

      • checkCallback: () => T

        The function executed to verify a particular condition until it's passed

      • doCallback: (value: T) => void

        The function executed when checkCallback returns true or some object

      • failCallback: (reason?: unknown) => void

        The function executed when checkCallback has failed for too long (went over the timeout)

      • timeout: number = 10000

        The duration in milliseconds until the task is aborted (defaults to 10 seconds)

      • checkFrequency: number = 100

        The frequency in milliseconds to callback for a check (defaults to 100 milliseconds)

      Returns void