• Save
Javascript code in a native app
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
877
On Slideshare
606
From Embeds
271
Number of Embeds
2

Actions

Shares
Downloads
0
Comments
0
Likes
0

Embeds 271

http://de.bemyapp.com 270
http://webcache.googleusercontent.com 1

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Javascript code in anative appGraphically intensive and interactiveKevin Readkread@boerse-go.de@unverbraucht
  • 2. Javascript rocks● Its great○ fast○ cross-platform○ runs (nearly) everywhere● So we built a Canvas-based chart analysistool in JS with a gazillion features:○ Quick demo
  • 3. ● On mobile, canvas not there yet for us○ 2-3 fps performance○ Differences in touch handling over browsers● Porting not an option○ 30k LOC of JS times two platforms● Idea: Reuse JS version○ Embed JS VM into app, here v8○ Custom code for canvas, AJAX, websocket, ...JS isnt for everything
  • 4. Android embedding architectureDalvik VM(Java) App (Views, Activities)
  • 5. Android embedding architectureDalvik VM(Java)v8Engine singletonJNI(C/C++) BGJSContextv8(JS)JS ChartApp (Views, Activities)initializesload andexecuterequiresOther JS files
  • 6. Android embedding architectureDalvik VM(Java)v8Engine singletonJNI(C/C++) BGJSContextv8(JS)JS ChartBGJSModulesApp (Views, Activities)initializesEjecta + BG(Canvas inOpenGL)register asJS functionsload andexecuteOther JS filesrequires
  • 7. Android embedding architectureDalvik VM(Java)v8Engine singletonJNI(C/C++) BGJSContextv8(JS)JS ChartBGJSModulesApp (Views, Activities)initializesv8TextureView(GL init, pageflip,touch, ..)addsEjecta + BG(Canvas inOpenGL)register asJS functionsload andexecuteOther JS filesrequires
  • 8. Android embedding architectureDalvik VM(Java)v8Engine singletonJNI(C/C++) BGJSContextv8(JS)JS ChartAjax Helper(threading, IO, ...)BGJSModulesApp (Views, Activities)initializesv8TextureView(GL init, pageflip,touch, ..)addsAjaxModuleEjecta + BG(Canvas inOpenGL)register asJS functionsload andexecuteAuthModule...Other JS filesrequires
  • 9. DemoFinger crossing plz.
  • 10. Lessons learned and end● Embedding a JS VM is a big to epic win○ Performance gain x20 (!)○ Oh, and works on x86 too of course :D● But plan to take some time:○ v8 is great, but steep learning curve.○ Debugging JNI/NDK can be very painful.Thanks for your time.@unverbraucht+Kevin Read: http://gplus.to/unverbrauchtEjectaJS for iOS: http://impactjs.com/ejectaMartins stuff: https://github.com/Tharitgplus.to/unverbraucht