waitToggled | WebHare Platform SDK
WebHare Platform SDK
    Preparing search index...

    Function waitToggled

    • Wait for a condition from false to true when executing a specific code.

      This is generally equivalent to assert(!test); run(); wait(test); but helps prevent mistakes if the two test conditions weren't identical, or if they became true because of another side effect rather than the run() function.

      Type Parameters

      • T

      Parameters

      • test: { run: () => unknown; test: () => T | Promise<T> }

        A function that should resolve to falsy value before run() is invoked (tested immediatley and after one tick), and to a truthy value once run() has completed

      • Optionaloptions: Annotation | { annotation?: Annotation; timeout?: number }

      Returns WaitRetVal<T>