Can i use OSX native API's in electron

I realize this is a late answer but you have some options:

  • native node modules allow you to write in C++ and ObjectiveC (or Swift) and expose an API to node.js using v8. This gives you a lot of flexibility and power but requires the most time to develop.

  • NodObjC is a native node module that allows you to interact with the ObjC runtime. I've never used it but it seems like a solid project and would simplify whatever you're trying to do. Another option similar to this is node-ffi. The framework you referenced looks like an ObjC API though, so not sure if that'll work for your specific use case.

  • For simple stuff, you can use node-applescript. I've only played with applescript a little bit but I was surprised at some of the things you can do with it. For example, you can use it to set your app to start on login (see node-auto-launch). While limited compared to the above, if it does what you want, it's simpler and requires no compiling, which is nice. Note that this is going to use child_process under the hood to spawn a new process to run the applescript in. That may have some ramifications to consider for whatever you're trying to do.

  • You can also just use the node child_process module if the OSX API you're trying to use has a good CLI. The upside here is simplicity, the downside is you may have to parse the strings it outputs into meaningful data structures, which can be moderately difficult in my experience.