Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Building fast single page apps with DoneJS

Building fast single page apps with DoneJS

earn how to build the fastest single page applications with DoneJS (http://donejs.com). This talk details some most important performance techniques used in single page applications like: server side rendering, progressively loading optimized bundles, and use of content delivery networks. We will discover how DoneJS solves these problems while building a simple real-time chat application.

Matthew Phillips

January 20, 2016
Tweet

Other Decks in Technology

Transcript

  1. FAQ • Open Source JavaScript framework (MIT) • Backend services

    agnostic • Built on top of: • StealJS (SystemJS) • CanJS (jQuery, Zepto, Dojo, or Mootools) • Testee (FuncUnit; Syn; QUnit, Mocha, or Jasmine) • DocumentJS • can-connect (can-set) • can-ssr (can-simple-dom; NodeJS) • IE8 Support • Windows, Linux, OSX • Node 5, 4, 0.12, IoJS • Not a new framework!
  2. • Server Side Rendering • Progressive Loading • Data Caching

    • Minimal DOM Updates • Worker Rendering • CDN Deploys • Comprehensive Testing • Hot Module Swapping • CI & CD • ES6 Modules • NPM Packages • Modlets • Custom Elements • MVVM • Generators • Real Time • Two-way Routing • IE8+ • iOS, Android • Desktop Performance Maintainability Usability
  3. Performance • Server Side Rendered aka Isomorphic aka Universal •

    Progressive Loading • Minimal Data Requests • Minimal DOM updates • Worker Thread Rendering • CDN Deploys
  4. Traditionally Built SPA <html> <head> <link href="production.css" rel="stylesheet"/> </head> <body>

    <img src="loading.png"/> <script src="production.js"></script> </body> </html>
  5. Traditional Timeline <html> <head> <link href="production.css" rel="stylesheet"/> </head> <body> <img

    src="loading.png"/> <script src="production.js"></script> </body> </html> html CSS & JS data
  6. Chat • Server Side Rendering • Progressive Loading • Data

    Caching • CDN Deploys • Hot Module Swapping • NPM Packages • Custom Elements • Generators • Real Time
  7. Steps 1. Setup 2. Add Bootstrap and checkout “Hot Module

    Swapping” and SSR 3. Add routing 4. Finish messages page 5. Connect real time service 6. Finish homepage 7. Build and Deploy
  8. New new 1 new 2 todoConnection.getList({type: 'new'}) todoConnection.getList({type: 'assigned'}) [{id:

    1,…},{id: 2,…}] [{id: 3,…},{id: 4,…}] Assigned assigned 3 assigned 4 real-time behavior
  9. New new 1 new 2 todoConnection.getList({type: 'new'}) todoConnection.getList({type: 'assigned'}) [{id:

    1,…},{id: 2,…}] [{id: 3,…},{id: 4,…}] Assigned assigned 3 assigned 4 real-time behavior
  10. New new 1 new 2 todoConnection.getList({type: 'new'}) todoConnection.getList({type: 'assigned'}) [{id:

    1,…},{id: 2,…}] [{id: 3,…},{id: 4,…}] Assigned assigned 3 assigned 4 {type: 'assigned'} {type: 'new'} real-time behavior
  11. New new 1 new 2 [{id: 1,…},{id: 2,…}] [{id: 3,…},{id:

    4,…}] Assigned assigned 3 assigned 4 {type: 'assigned'} {type: 'new'} real-time behavior
  12. New new 1 new 2 [{id: 1,…},{id: 2,…}] [{id: 3,…},{id:

    4,…}] Assigned assigned 3 assigned 4 {type: 'assigned'} {type: 'new'} listStore real-time behavior
  13. New new 1 new 2 Assigned assigned 3 assigned 4

    listStore todoConnection.updateInstance({ id: 2, type: 'assigned' }) real-time behavior [{id: 1,…},{id: 2,…}] [{id: 3,…},{id: 4,…}] {type: 'assigned'} {type: 'new'}
  14. New new 1 new 2 [{id: 3,…},{id: 4,…}, ] Assigned

    assigned 3 assigned 4 listStore real-time behavior todoConnection.updateInstance({ id: 2, type: 'assigned' }) [{id: 1,…},{id: 2,…}] {type: 'assigned'} {type: 'new'}
  15. New new 1 new 2 Assigned assigned 3 assigned 4

    listStore real-time behavior todoConnection.updateInstance({ id: 2, type: 'assigned' }) todoConnection.updateInstance({ id: 2, type: 'assigned' }) [{id: 1,…}] [{id: 3,…},{id: 4,…},{id: 2,…}] {type: 'assigned'} {type: 'new'} listStore
  16. New new 1 new 2 [{id: 1,…}] [{id: 3,…},{id: 4,…},{id:

    2,…}] Assigned assigned 3 assigned 4 {type: 'assigned'} {type: 'new'} listStore real-time behavior todoConnection.updateInstance({ id: 2, type: 'assigned' })
  17. New new 1 new 2 [{id: 1,…}] [{id: 3,…},{id: 4,…},{id:

    2,…}] Assigned assigned 3 assigned 4 {type: 'assigned'} listStore todoConnection.updateInstance({ id: 2, type: 'assigned' }) assigned 2 real-time behavior {type: 'new'}
  18. Chat • Server Side Rendering • Progressive Loading • Data

    Caching • CDN Deploys • Hot Module Swapping • NPM Packages • Custom Elements • Generators • Real Time
  19. Chat • Server Side Rendering • Progressive Loading • Data

    Caching • CDN Deploys • Hot Module Swapping • NPM Packages • Custom Elements • Generators • Real Time • iOS, Android • Desktop