Similar method to setTimeout or setInterval within [ js ] ?

aceslowman's icon

Is there any way to do something equivalent to setTimeout() or setInterval() in the js object? I'd like to have some timed events within my javascript, Max is hanging when the object is receiving bangs too quickly, so I want to do some internal timing to see if that will help. I know that setTimeout() is browser related, so I assume that is why I get an error saying it's not defined.

Jan M's icon

setTimeout() and setInterval() are methods of the window object in browsers. Max doesn't have that, that's why they are not defined. But there is a Task object for timing in Max. (Check the docs for examples). If you are dealing with timing critical tasks, keep in mind that JS in Max is always single threaded and will run in the low priority queue of the scheduler.