JavaScript goes native for iOS, Android, and Windows Phone apps

The NativeScript development tool uses JavaScript and Typescript to build native apps for iOS, Android, and Windows Phone

development tools toolbox saw wrench hammer measure
Credit: Shutterstock

NativeScript, a Telerik technology for building multiplatform native mobile apps from a single code base, is set to go to a 1.0 release in late April. Telerik is launching a beta program this week for the open source NativeScript.

The NativeScript website and GitHub page describe the runtime as enabling developers to use JavaScript and TypeScript to build native apps for iOS, Android, and Windows Phone (via the Windows Universal strategy) and share code across the platforms. "Developers who have that Web skill set who want to build truly native applications should be really excited because there is now a way for them to do that" without having to learn custom languages or frameworks, said Telerik Vice President Todd Anglin.

NativeScript produces apps that have a native UI, Anglin said. "That is, the app is not HTML-rendered in a Web view -- as you get with hybrid apps or traditional browser apps. ... [NativeScript enables] the underlying JavaScript engines on iOS, Android, and Windows to control a native UI layer."

Developers use NativeScript libraries, which abstract away the differences between the native platforms; they also use CSS and ECMAScript 5. The Node.js server-side JavaScript platform "sort of [helps] play that JavaScript engine role that powers the mobile app," Anglin said.

NativeScript provides full access to the native platform API, and it features a prepackaged JavaScript virtual machine; JavaScript written for a NativeScript app still runs as JavaScript on a device. "NativeScript will execute this JavaScript on the native JavaScript virtual machines provided by iOS (JavaScriptCore), Android (V8), and Windows (Chakra)," Anglin said. NativeScript provides "a JavaScript proxy that exposes all of the underlying native iOS/Android/Windows APIs to these JavaScript engines, thereby giving full control to JavaScript to control native device capabilities."

NativeScript also handles the cross-platform native UI, providing a markup language that gets parsed in to platform-specific UI widgets when an application is built. "For example, when a developer adds a button to an app, NativeScript will automatically use the appropriate native button UI control from iOS, Android, and Windows."

Anglin sees NativeScript as being different from other mobile development technologies, such as Appcelerator Titanium, which also purports to enable the building of native mobile apps via JavaScript. Titanium has too much customization, making it proprietary, Anglin contends.

"The big distinction between a NativeScript app and a hybrid app [such as PhoneGap or Sencha] is that NativeScript does not rely on the browser/Web UI layer to render the app. It renders a native UI, independent of the browser. ... That browser/Web UI layer that is usually the performance bottleneck in mobile apps that want to have buttery smooth animations and scrolling."

Telerik, which announced NativeScript last June, hopes to monetize NativeScript by offering premium UI tools and platform tooling.

This story, "JavaScript goes native for iOS, Android, and Windows Phone apps" was originally published by InfoWorld.

ITWorld DealPost: The best in tech deals and discounts.
Shop Tech Products at Amazon