PsyTask | API Docs
    Preparing search index...

    Type Alias Timer

    type Timer = {
        start(onFrame?: (time: number) => void): Promise<TimerRecords>;
        stop(): void;
    }
    Index

    Methods

    Methods

    • If called in rAF callback or microtasks generated by rAF callback, the start time (the first element of timer records) will be the current frame time, otherwise the next frame time.

      Parameters

      • OptionalonFrame: (time: number) => void

      Returns Promise<TimerRecords>

      Do not repeat

      timer.start();
      timer.start(); // error

      await timer.start();
      timer.start(); // right

      timer.start();
      timer.stop();
      timer.start(); // right
    • Returns void