Tags: Node.JS »»»» Mobile Applications
Node.js is no longer limited to server-side application development. The Electron platform, popularized through the Atom editor, is an excellent way to develop desktop applications. Now it's possible to target mobile devices running either iOS or Android using a Node.js implementation. Janea Systems is offering a "library" for both iOS and Android systems allowing an app to host a full Node.js execution environment, and offering UI implementation either with Cordova or React Native.
The toolkit, named Node.js for Mobile Applications, is based on Node-ChakraCore. That's a variant of Node.js based on Microsoft's Chakra JavaScript engine, making it a different implementation from traditional Node.js based on Google's V8 JavaScript engine.
Janea first announced work on Node.js for IOS or Android in June 2017. By switching JavaScript engines, Janea is able to circumvent Apple's rules for the iOS App Store. Apple does not allow Just-In-Time compilation for anything but their own JavaScript engine. That restriction prevents anything based on the V8 engine from the AppStore, and therefore Node.js-V8 based applications would not be allowed.
There's a risk that Node-ChakraCore would diverge from Node.js-V8, and therefore have a different featureset. The Node-ChakraCore team gets around this by creating a thin V8-compliant shim on top of the Chakra JavaScript engine. This way Node-ChakraCore can reuse the top level of regular Node.js-V8 gluing it to ChakraCore.
This fact distinguishes Node-ChakraCore from an earlier project, JXCore, which made many changes to the Node.js layer to interface with other JavaScript engines. JXCore was also able to run on iOS and Android, but eventually that project failed when the parent company failed.
Janea Systems had experience with JXCore, supporting it for the Thali project. The company applied that experience to develop Node.js for Mobile Applications.
When running, the platform has one thread for the UI and another for the Node.js runtime. The two threads communicate using what Janea describes as "a high-performance messaging channel that can be used to send data back and forth". JavaScript code can also make direct synchronous calls into native code (Java, ObjectiveC, Swift, etc).
Node-ChakraCore is only used on iOS, due to Apple AppStore requirements as described earlier. On Android, they use the V8 engine, making this a fairly normal Linux port of Node.js, "but with a few platform-specific tweaks and fixes".
A high level of compatibility with Node.js is a requirement for both implementations.
Node.js for Mobile Applications is currently described as Alpha quality, and is free.
Announcement: http://www.janeasystems.com/blog/announcing-node-js-mobile-apps-true-node-js-runtime-android-ios/
Website: https://code.janeasystems.com/nodejs-mobile
Github project: https://github.com/janeasystems/nodejs-mobile
A demo application is here: https://github.com/janeasystems/node-mobile-react-demo