@revideo/core / threading / spawn
Function: spawn()
spawn(
task):ThreadGenerator
Defined in: threading/spawn.ts:29
Run the given task concurrently.
Parameters
task
ThreadGenerator | (() => ThreadGenerator)
Either a generator function or a task to run.
Returns
Example
Using an existing task:
spawn(rect().opacity(1, 1));Using a generator function:
spawn(function* () {
yield* rect().opacity(1, 1);
yield* waitFor('click');
yield* rect().opacity(0, 1);
});Await the spawned task:
const task = spawn(rect().opacity(1, 1));
// do some other things
yield* join(task); // await the task