Studio

Z.every(...)

Z.every(ms: number, func: () => void): void;

Runs a function repeatedly after the specified time has passed. This may occur some number of milliseconds beyond the specified interval due to variable frame times.

This repeating function call can be stopped by calling Z.everyOff(...).

Parameters

Parameter Type Description
ms number The number of milliseconds that must have elapsed before the function will be called each time.
func function The function to be called every time the interval has elapsed.

Example

function myRepeatingFunction() {
    //a function to repeatedly call
}
//call myRepeatingFunction every 2000ms (2 seconds)
Z.every(2000, myRepeatingFunction);
Open in new window