MCPcopy
hub / github.com/midrender/revideo / waitFor

Function waitFor

packages/core/src/flow/scheduling.ts:21–39  ·  view source on GitHub ↗
(
  seconds = 0,
  after?: ThreadGenerator,
)

Source from the content-addressed store, hash-verified

19 * @param after - An optional task to be run after the function completes.
20 */
21export function* waitFor(
22 seconds = 0,
23 after?: ThreadGenerator,
24): ThreadGenerator {
25 const thread = useThread();
26 const step = usePlayback().framesToSeconds(1);
27
28 const targetTime = thread.time() + seconds;
29 // subtracting the step is not necessary, but it keeps the thread time ahead
30 // of the project time.
31 while (targetTime - step > thread.fixed) {
32 yield;
33 }
34 thread.time(targetTime);
35
36 if (after) {
37 yield* after;
38 }
39}

Callers 15

generatorMethod · 0.90
Txt.test.tsxFile · 0.90
state.test.tsxFile · 0.90
delayFunction · 0.90
sequenceFunction · 0.90
scheduling.test.tsFile · 0.90
createQueueMethod · 0.90
cancel.test.tsFile · 0.90
example.tsxFile · 0.90
components.tsxFile · 0.90

Calls 4

useThreadFunction · 0.90
usePlaybackFunction · 0.90
framesToSecondsMethod · 0.80
timeMethod · 0.80

Tested by

no test coverage detected