(Choosing OmniPlan - OmniPlan for Mac for lack of a better selectable category).
Hi there.
I’m very interested in Automation for OmniPlan. I would like to know more about which kind of javascript enviroment our scripts get executed on. Is it a embedded nodejs? Which version?
Ultimately I’m trying to understand what can I do inside my scripts:
Which javascript syntax can i use?
If a superset of a nodejs version, can I import modules (for example, fs, so I can read local files in the filesystem; or https to make http requests)?
Can I import npm modules somehow (external libraries)?
Thank you, draft8! Sorry for my delayed response here.
That takes care of #2 and #3 I suppose.
Now the answer to one is more specific to Apple’s JavascriptCore, but if you have any pointers I’d greatly appreciate it: where can we find which version that JSContext is and how does it conform to ECMAScript standards?
I just want to know which kinds of javascript’s constructs and syntaxes would be available for me to use…
The interpreter provided by a JSContext instance is that used by the JSC of the given macOS version, and is essentially that of the version of Safari current at the macOS release.
(You can’t, of course, update the system JSC by installing a later version of Safari)
Grosso modo, it will certainly be a highly compatible ES6 (omniJS is not available on earlier macOS versions), and finer-grained specifics should show up in the Safari columns here:
PS if you are referring to JXA (which reaches back further than omniJS) it will be ES6 from Sierra onwards, ES5 for the preceding macOS, and absent in any form before that.