NativeScript Runtime Preview for Windows 10


Windows Mobile support is one of NativeScript's most wanted features and we are happy to announce that today we are open-sourcing our work on the NativeScript Runtime for the Universal Windows Platform (UWP). The repository is available on GitHub and there is a minimalistic sample application that you can run:

windows-runtime-preview

The application also works on Windows Mobile 10, which is expected to go live this month.

The NativeScript Runtime allows Windows Runtime APIs to be called from JavaScript. It is similar to the JavaScript bridge that Microsoft provides, but also allows XAML UI controls to be instantiated. This way NativeScript apps are again truly native, instead of being HTML based.

Please note, at the moment the runtime is in a proof of concept stage. It allows for very limited interoperability between JavaScript and the native world (only calling simple methods with primitive types). However this is the foundation for more advanced features such as inheritance, generics, advanced marshalling - all problems that we have solved in the iOS and Android runtimes. It's just a matter of time, before we bring the Windows Runtime to full speed.

The NativeScript Runtime implementation for Windows is based on JavaScriptCore and libffi:

  • JavaScriptCore is the JavaScript engine used to parse and execute JavaScript source files. By itself, a JavaScript engine isn't tied to any particular environment. For example, browsers extend it with web stuff (window, document , navigator, …) and Node.js does with it with its own APIs (global, require, process, …). We are extending JavaScriptCore to make it possible to interact with the Windows Runtime APIs from JavaScript.
  • libffi is the glue to make it all work. It ties the JavaScript engine and the underlying native APIs. libffi allows an interpreted language such as JavaScript to dynamically invoke existing native C functions or create new ones at runtime.

What's Next

Keep in mind the runtime is only a part of the whole story. There is quite a bit of work to integrate the NativeScript Runtime for the Universal Windows Platform (UWP) with the  NativeScript CLI. Our cross-platform modules also need to be updated to account for Windows. There is a lot of work to do, to be sure. In the end, we will deliver a smooth development experience, just like we do with our iOS and Android environments.

We'd like to understand the needs and plans for bringing cross-platform mobile apps to Windows devices. Let us know in the comments what you think about Windows Mobile 10 and NativeScript.

Author

Jason Zhekov

Comments


Comments are disabled in preview mode.
NativeScript is licensed under the Apache 2.0 license
© 2020 All Rights Reserved.