It's a shame that Open Scripting Architecture has languished. It let you write scripts to extend and connect applications on your Mac in very powerful ways, in any OSA language you choose (including Javascript).
Unfortunately AppleScript was the default language, has always been terrible (IMHO), and became more so with OS X. Apple Events took a serious backseat with OS X as well, making it difficult to implement in your app.
Well, Apple purposely killed Apple Events making them impossible to be sent from sandboxed apps. While I'm not a fan of JavaScript as a language, it has the advantage to be commonly known and I think if it gets more used for app scripting it can be powerful. Sketch seems to be moving from CocoaScript to JS…
Unfortunately AppleScript was the default language, has always been terrible (IMHO), and became more so with OS X. Apple Events took a serious backseat with OS X as well, making it difficult to implement in your app.