function setTimeout
Supported only in the v8 engine. Introduced in Max v9.2.0.
Schedules a one-shot callback to run after a delay.
Backed by the Max scheduler; the returned handle is a numeric ID for use with clearTimeout().
export declare function setTimeout(
callback: (...args: any[]) => void,
delay?: number,
...args: any[]
): number;
| Name | Type | Description |
|---|---|---|
| callback | (...args: any[]) => void | the function to run when the timer fires |
| optional delay | number | delay in milliseconds before the callback runs (default 0) |
| args | any[] | additional arguments forwarded to the callback |
| Return Value | number | a numeric timer ID |
Example
const id = setTimeout((name) => post("hello", name, "\n"), 250, "world");
// ...
clearTimeout(id);