A Lap Around NativeScript TJ VanToll | @tjvantoll What is - - PowerPoint PPT Presentation

a lap around nativescript
SMART_READER_LITE
LIVE PREVIEW

A Lap Around NativeScript TJ VanToll | @tjvantoll What is - - PowerPoint PPT Presentation

A Lap Around NativeScript TJ VanToll | @tjvantoll What is NativeScript? A runtime for building and running native iOS, Android, and Windows Phone apps with a single, JavaScript code base != No DOM != No cross compilation !=


slide-1
SLIDE 1

A Lap Around NativeScript

TJ VanToll | @tjvantoll

slide-2
SLIDE 2

What is NativeScript?

  • A runtime for building and running native iOS,

Android, and Windows Phone apps with a single, JavaScript code base

slide-3
SLIDE 3
  • No DOM
  • No cross compilation

!= !=

  • Direct access to

native APIs in JS

!=

slide-4
SLIDE 4
  • Bridge
slide-5
SLIDE 5

NativeScript Android example

Output:

slide-6
SLIDE 6
slide-7
SLIDE 7

NativeScript iOS example

slide-8
SLIDE 8
slide-9
SLIDE 9

How does this work?

slide-10
SLIDE 10

NativeScript and JS VMs

  • NativeScript runs JavaScript on a JavaScript VM
  • JavaScriptCore on iOS
  • V8 on Android
  • JavaScriptCore on Windows
slide-11
SLIDE 11
  • Runs on V8
  • Runs on JavaScriptCore
slide-12
SLIDE 12

Gathering Native APIs

  • NativeScript uses reflection to build a list of

available APIs for each platform.

  • For optimal performance, this metadata is pre-

generated, and injected into the app package at build time.

slide-13
SLIDE 13

Injecting native APIs

  • V8/JavaScript

Core have APIs to inject global variables

slide-14
SLIDE 14

Invoking native APIs

  • V8/JavaScriptCore have C++ callbacks for JS function

calls and property accesses.

  • The NativeScript runtime uses those callbacks to

translate JS calls into native calls.

  • On iOS, you can directly call Objective-C APIs from C+

+ code.

  • On Android, NativeScript uses Android’s JNI (Java

Native Interface) to make the bridge from C++ to Java.

slide-15
SLIDE 15
slide-16
SLIDE 16
slide-17
SLIDE 17
slide-18
SLIDE 18

NativeScript file module

slide-19
SLIDE 19

HTTP module example

slide-20
SLIDE 20

Community modules

slide-21
SLIDE 21

But how do I turn this into an app?

slide-22
SLIDE 22

Two ways to use NativeScript

1) 2)

slide-23
SLIDE 23
  • Backend-as-a-service
  • Push notifications, cloud data, file storage, and more
  • Analytics
  • AppBuilder
  • Cloud builds (build iOS apps on Windows, Windows Phone apps on

a Mac)

  • NativeScript debugging and tooling
  • Automated app testing
  • And more!

http://telerik.com/platform

slide-24
SLIDE 24

https://www.telerik.com/purchase/platform

slide-25
SLIDE 25

NativeScript CLI

  • Free and open source
  • https://github.com/nativescript/nativescript-cli
slide-26
SLIDE 26

NativeScript CLI requirements

  • https://github.com/nativescript/nativescript-

cli#system-requirements

  • Xcode, Xcode CLI tools, iOS SDK
  • JDK, Apache Ant, Android SDK
slide-27
SLIDE 27
slide-28
SLIDE 28

Follow NativeScript

  • @nativescript
  • https://nativescript.org/blog
slide-29
SLIDE 29

Contribute! (nativescript.org/contribute)

slide-30
SLIDE 30

Thanks!

  • TJ VanToll | @tjvantoll
  • Like this talk?
  • Rate it at http://bit.ly/next-vantoll-2
  • Hated this talk?
  • Use http://bit.ly/next-holland