Internal clock in JS?

Roald Baudoux's icon

Hello,

Is it possible to trigger events on a regular basis (clock) from within a JS object itself without the help of a metro or similar external object? Is it the purpose of a task?

tyler mazaika's icon

Yes, Task, as you mention.

Ernest's icon

This is the third instance of archaic code in C74 I am pointing out today. The Task object was only necessary because Js used to be able to run in the high priority thread. C74 since declared js would only run in the low priority thread, So there is no reason for js to have a special object for this. C74 could support the standard setTimeout() and setInterval() functions in js with very little effort.

While people may regard my issues pedantic or annnoying, they having gone through the effort of programming things in C74's weird way, it is not good for the company's future to continue to maintain its unnecessary baggage from prior changes in direction.

I have also indicated that its new languages all support typeless declarations, whereas the original max objects were strongly typed. It just makes no sense to me. In my opinion, as javascript is the first language most people learn, all its types should work as much like javascript as possible, and there is no reason to inflict the schizophrenia on new users. My opinion doesn't count for much any more, of course, being 70 and deaf, but I did program stuff all my life, and having watched the degradation in math skills for a long time with some disappointment, the fact is, Americans are just not as interested in learning maths as they were, so that's the way it is, like it or not.

Roald Baudoux's icon

I agree on the fact that the JS implementation in Max is old and quite behind what you can have in any browser nowadays. This is sad.

Jan M's icon

Yes it would be nice to see the JS object updated. I remember reading a comment of one of the C74 developers that this is quite a big undertaking. I have the impression [js] is treated as a legacy object (like [mxj]) and that they settled on the node.js implementation as a substitute. Though in my personal opinion node.js is quite a mess in general (I am not referring to the Max implementation but node.js in general) and it brought dependency hell to a new level ...
(Just my 2 cents)