362636 (1) [Avatar] Offline
With much interest, I just read the Chapter 1 free download. jQuery Mobile is not mentioned in the Chapter 1 (Introduction). How does NativeScript compare with jQuery? Currently, I am using jQuery Mobile to develop my cross-platform web apps.

As well, jQuery Mobile can run on desktop browsers though bit with 'weird' display. How does NativeScript handle desktop browsers? By means of 'one code cross-platform', I would like to see NativeScript also runs fine on desktop.
mikebranstein (12) [Avatar] Offline
Great question, and thanks for taking a look at Chapter 1!

There is an important designation between jQuery mobile and NativeScript. Without going into great detail, jQuery mobile and NativeScript are in a different class of development frameworks.

jQuery Mobile

jQuery mobile is used when developing web sites with HTML, JavaScript, and CSS. Websites developed with jQuery mobile can be either hosted on a web server (just like any other web site you'd find online) or be embedded within a hybrid mobile app container (like PhoneGap/Cordova). I call this a hybrid app because, yes the app is running on a mobile device, but as soon as the app launches, a web browser is silent launched in the background and loads your embedded web site.

A simplified example of this approach is placing a button on a page: you place an HTML <button> element on an HTML page and style it with jQuery mobile. When the app loads, a web browser is launched, loads your page, interprets the button, then renders it within the web browser. When you interact with the button (i.e., click or tap) you are actually interacting with a mobile-friendly web site, not native Android/iOS elements.


NativeScript is entirely different. NativeScript instead uses the native APIs of each platform (Android or iOS) to render and display native controls. Let's take the same example I cited above with a button. In NativeScript, you don't write HTML, but instead XML. So you create an XML document and place a <Button> on the page. This is very similar to HTML. When the app loads, the NativeScript run time is launched, the run time reads your XML page and directly talks back to the native Android/iOS API to create a native Android or iOS page. The run time then create a native button and places it within the native page. No web browser is used. When you interact with the button (via a tap on the screen), you're actually interacting with the native Android/iOS button.

This is a bit over-simplified, but I got excited about NativeScript because of it's elegance and simplicity. I had relatively little mobile development experience prior to using NativeScript, and once I started using it, I was hooked.

If you're interesting in the deep-dive on how NativeScript works, check out Ed Charbeneau's Eat, Sleep, Code podcast, where he interviews TJ VanToll about NativeScript: http://developer.telerik.com/featured/nativescript-inside-the-black-box/

You can also read through the FAQs on Telerik's website: http://www.telerik.com/platform/nativescript/faq

I also have several articles on my blog about NativeScript and how it differs from hybrid app development with jQuery: https://brosteins.com/2015/09/22/nativescript/ and https://brosteins.com/2015/01/29/building-mobile-apps-native-vs-hybrid/

Finally, Nick and I go into greater depth of how NativeScript works in chapters 2 and 3. If you're interested in picking the book up during MEAP, let me know and I'll send you a 40% off discount code for being the first person to post int he author forum!

Thanks again.