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

The State of JavaScript

The State of JavaScript

Jack Franklin treats us to his talk on 'The State of JavaScript', where he explores, discusses and criticises the current state of web development with JavaScript.

Frontend NE

August 04, 2016
Tweet

More Decks by Frontend NE

Other Decks in Technology

Transcript

  1. 5

  2. 6

  3. 1. Two way data binding is great but needs dirty

    checking which is...dirty 2. Let's implement Object.observe natively to deal with this 3. Oh hey, ReactJS! 35
  4. 44

  5. Some features are loved —Promise makes async code a bit

    more intuitive —Arrow fns make scope intuitive —let makes bindings intuitive 50
  6. Some features have that JS Quirk (TM) const person =

    { name: 'Jack', age: 24, supports: 'Newcastle' } 51
  7. And some are less loved... class Crockford extends IDontLikeThis {

    constructor() { this.mistake = true; } } 54
  8. Was going to be called contains, but MooTools adds Array.prototype.contains...

    2 2 https://esdiscuss.org/topic/having-a-non-enumerable-array-prototype-contains-may-not-be-web- compatible 57
  9. —Stage 0: strawman —Stage 1: proposal —Stage 2: draft —Stage

    3: candidate —Stage 4: finished http://www.2ality.com/2015/11/tc39-process.html 60
  10. // returns a Promise function getUser() {...} async function logUser()

    { let user = await getUser(); console.log('USER!', user); } 66
  11. 69

  12. 70

  13. ES2015 support —Edge 14: 90% —Chrome 52 / Opera 39:

    98% —FF 49: 93% —Safari 10: 100% (kinda, read on...) —Node 6: 93% 71
  14. Note: "100% ES2015 support" is misleading —ES2015: the module syntax

    —Not specced: module loading (Yes, this is really confusing!) 72
  15. A browser can claim 100% ES2015 support, like Safari 10

    And it's technically true. But kinda, not really. 73
  16. 75

  17. 79

  18. ! —Developers can try out new features ahead of time

    —Feedback loop is shortened —JS proposals don't feel so far away 80
  19. Be wary of depending on Babel plugins for early stage

    proposals Or at least, be prepared for a rewrite. 82
  20. —Edge 14: 90% —Chrome 52 / Opera 39: 98% —FF

    49: 93% —Safari 10: 100% (kinda) —Node 6: 93% 87
  21. If you want to stick right on the cutting edge

    and use features before they are in browsers, yes. 90
  22. If you're happy to use a subset of new features,

    or lucky enough to target "modern" browsers, no. 91
  23. Once ES2015 is fully supported across all browsers most people

    build for, less people will use transpilers 92
  24. ES2015 had three goals: —better for complex web applications —better

    for library authors —better as a target language 94
  25. This will keep happening Varying levels of "transpilerness": —Babel (ES

    features + JSX) —TypeScript (Superset of JS) —Elm (WTF IS GOING ON) 98
  26. NodeJS is dreamy $ npm install x // index.js var

    x = require('x'); $ node index.js 103
  27. ES2015 modules in the browser 3 <script type="module"> import {

    fn } from './lib'; import React from 'http://cdn.com/react.js'; </script> 3 not yet supported across browsers 106
  28. 108

  29. Use map from Lodash: var _ = require('lodash'); _.map(...); Then:

    some-bundle-tool app.js > bundle.js Included: —your code —ALL of Lodash 111
  30. In a fully ES2015 moduled world import { map }

    from 'lodash'; _.map(...); Then: some-bundle-tool app.js > bundle.js Included: —your code —Just lodash.map! 112
  31. 117

  32. Webpack is not the baseline Gulp / Grunt is not

    the baseline browserify is not the baseline React is not the baseline 126
  33. ! Load Instantly (Service Worker) ! Add to Home Screen

    ! Web push notifications ! Secure ! Fast ! Responsive https://developers.google.com/web/progressive- web-apps/ 143
  34. Flipkart, India’s largest e- commerce site, decided to combine their

    web presence and native app into a Progressive Web Application that has resulted in a 70% increase in conversions. 6 6 https://developers.google.com/web/showcase/2016/flipkart 145
  35. 147

  36. Once the initial page is displayed, a request is made

    to fetch the rest of the site's React app. 149
  37. All subsequent navigation is blindingly fast, not suffering the latency

    of HTTP requests since the browser already has the whole app. 150
  38. If the user does not have JS, they still experience

    the fully rendered page and only miss out on the fast navigation. 151
  39. Is it hard work to build a performant, mobile friendly,

    offline first web application? 156
  40. 165