I never got around to posting this: I use these utility functions quite a lot in other scripts. I've tried to document them within the code, so I won't repeat here. The timeout and interval functions will not be needed in the 10.5 release of PDF-XChange.
Initially I was planning to minify the script, but because this is all loaded locally, I didn't see a need.
xutil.setInterval xutil.setTimeoutNote that capitalization matches javascript in browsers (the built-in app.setTimeOut() capitalizes 'Out'.)
These extend the built in app methods to allow one to pass functions. I find this much easier to work with because I can use closures. Instead of returning an object, they return an integer greater than zero on success.
xutil.clearInterval xutil.clearTimeout
Functions to clear the interval or timeout set with the above functions.
xutil.getNewAnn
Get an annotation as soon as it's drawn
xutil.PXEmacro
Minimal PDF-XChange macros class for javascript
Last edited by Mathew on Wed Dec 04, 2024 1:07 am, edited 5 times in total.
I changed the parameters that get sent to the timeout and interval functions. Now 'this' (the current doc) is sent if no additional args are supplied, otherwise, only the additional args.