If you start working on an extension for one of Adobe CS products it can be really annoying or even disappointing once you find out that there is not any of java-script timing events available!
No setInterval, no timeout! no nothing! which means you don’t even have a choice, all the code you write, HAS TO be blocking!
That was (and probably is still kind of!) my situation! in fact, I’m working on my memoir, and both in my university and our lab place I have access to the whole set of Adobe products, (Oh, forgot to say: I’ll use Indesign to publish/design (page-making) my memoir), and since it have never been convenient for me to do things the easy way, I decided to write a plugin for In-Design so it will do for me what I wanted to do! Yeah, pretty much my first essay on creating an extension for an Adobe product…
Let’s make it short for you (I’ll probably talk more about that plugin, once it was ready!), I did a lot of research and read almost 500 pages of (really bad documented) adobe documents! to find out that there is no way to write a non-blocking check-loop; BUT…
But after I gave up, I thought it will bother me if I don’t try the last, and least probable idea! and that was the answer! (kind of) in fact I read almost all the possible event objects in Adobe ID and none of them were useful, but one of them raised my curiosity at-least and I thought give it a try! It is onIdle event and obviously it trigers on software IDLE time but it is more than that! in-fact you can check for system state in really short amounts of time (or long!) and it will return it to you, and that’s called an interval!! I would guess probably it won’t be precise but it would be enough good most certainly to help one to write a non-blocking UI or atleast give the option to user to choose the way s/he prefer (having the entire software freezes for the duration of the process or do it in the backrgund!)
Please let me know if you need more info / samples on it! my problem is solved now but I couldn’t find any helpful information online AT ALL, so I though I’d share it, 😉
there is an $.sleep() method available which that too, of course, is blocking!