Can I run any node app under nativescript? From my point of view nativescript is a different runtime than node.js. But Node.js incorporates the Google Chrome V8 JavaScript engine as well. The only difference seems that some major functionality of nativescript app depends on core modules and plugins, which provides access to the underlying native mobile platforms.
For example if I run npm install matrix-js-sdk
or npm install libp2p
, then I can create and run a ns
application with functionality of those packages in the same way as I would create a node application?
CodePudding user response:
There is two native bridges that connect the "native" and the "JavaScript" world. One for Android and one for iOS, and these two runtimes are the core of the framework enabling many of the unique features in NativeScript. These two runtimes are using different JavaScript engines - V8 for the Android runtime and JavaScriptCore for the iOS runtime. This means you can use node based library in nativescript apps. But some libraries will not work for example crypto
which uses
Secure random number generation
that is not supported by v8.
For more info on the issue check this.
For more info on how nativescript works check this.