Skip to main content

threading

import {...} from "@revideo/core/lib/threading";

Thread management.

Classes

Interfaces

Type Aliases

ThreadGenerator

type ThreadGenerator = GeneratorThreadGeneratorPromiseanyPromisableanyvoidvoidThreadany

The main generator type produced by all generator functions in Motion Canvas.

Examples

Functions

cancel

public cancel...tasks: ThreadGenerator[]: void

Cancel all listed tasks.

Example:

const task = yield generatorFunction();

// do something concurrently

yield* cancel(task);

Parameters


getTaskName

public getTaskNametask: Generatorunknownanyunknown: string

Parameters


isPromisable

public isPromisablevalue: any: value is Promisableany

Parameters


isPromise

public isPromisevalue: any: value is Promiseany

Check if the given value is a [Promise][promise].

Parameters


isThreadGenerator

public isThreadGeneratorvalue: unknown: value is ThreadGenerator

Check if the given value is a ThreadGenerator.

Parameters


join

public joinall: boolean...tasks: ThreadGenerator[]: ThreadGenerator

Pause the current generator until all listed tasks are finished.

Examples

Parameters


setTaskName

public setTaskNametask: Generatorunknownanyunknownsource: stringGeneratorunknownanyunknown: void

Parameters


spawn

Run the given task concurrently.

Examples

Parameters


threads

Create a context in which generators can be run concurrently.

From the perspective of the external generator, threads is executed synchronously. By default, each scene generator is wrapped in its own threads generator.

Examples

Parameters