Transcript
Page 1: Living in the ES6 Future, Today

TODAYLiving in the ES6 Future

Page 2: Living in the ES6 Future, Today

ES6?What is

Page 3: Living in the ES6 Future, Today

ECMAScript

JavaScript==

Page 4: Living in the ES6 Future, Today

ES5 Array.forEach

Function.bind

Object.defineProperty

Object.create

Page 5: Living in the ES6 Future, Today

ES6

Page 6: Living in the ES6 Future, Today

ES6 arrow functions

Page 7: Living in the ES6 Future, Today

ES6 classes

arrow functions

Page 8: Living in the ES6 Future, Today

ES6 classes

rest parameters

arrow functions

Page 9: Living in the ES6 Future, Today

ES6 classes

for ... of

rest parameters

arrow functions

Page 10: Living in the ES6 Future, Today

ES6 classes

for ... of

rest parameters

arrow functions

iterators

Page 11: Living in the ES6 Future, Today

ES6 classes

for ... of

rest parameters

arrow functions

iteratorsgenerators

Page 12: Living in the ES6 Future, Today

ES6 classes

for ... of

rest parameters

arrow functions

iteratorsgenerators

destructuring

Page 13: Living in the ES6 Future, Today

ES6 classes

for ... of

rest parameters

arrow functions

iteratorsgenerators

destructuring

unicode support

Page 14: Living in the ES6 Future, Today

ES6 classes

for ... of

rest parameters

arrow functions

iteratorsgenerators

destructuring

unicode support

block-scoped variables

Page 15: Living in the ES6 Future, Today

ES6 classes

for ... of

rest parameters

arrow functions

iteratorsgenerators

destructuring

unicode support

block-scoped variables

WeakMaps

Page 16: Living in the ES6 Future, Today

ES6 classes

for ... of

rest parameters

arrow functions

iteratorsgenerators

destructuring

unicode support

block-scoped variables

WeakMaps

proxies

Page 17: Living in the ES6 Future, Today

ES6 classes

for ... of

rest parameters

arrow functions

iteratorsgenerators

destructuring

unicode support

block-scoped variables

WeakMaps

proxies

spread operator

Page 18: Living in the ES6 Future, Today

ES6 classes

for ... of

rest parameters

arrow functions

iteratorsgenerators

destructuring

unicode support

block-scoped variables

WeakMaps

proxies

spread operatorand more!

Page 19: Living in the ES6 Future, Today

MEAN?What does all that

Page 20: Living in the ES6 Future, Today
Page 21: Living in the ES6 Future, Today

:(

Page 23: Living in the ES6 Future, Today

rest parametersfunction log(level) { var args = [].slice.call(arguments,1); }

Page 24: Living in the ES6 Future, Today

rest parameters

function log(level, ...args) { }

Page 25: Living in the ES6 Future, Today

default parametersfunction log(message, prefix) { prefix = prefix || "> "; console.log(prefix + message);}

Page 26: Living in the ES6 Future, Today

default parametersfunction log(message, prefix) { if (prefix === undefined) { prefix = "> "; } console.log(prefix + message);}

Page 27: Living in the ES6 Future, Today

default parametersfunction log(message, prefix = "> ") { console.log(prefix + message);}

Page 28: Living in the ES6 Future, Today

block-scoped vars

console.log(i);if (false) { var i = 10;}

Page 29: Living in the ES6 Future, Today

block-scoped vars

var i;console.log(i);if (false) { i = 10;}

Page 30: Living in the ES6 Future, Today

block-scoped vars

console.log(i); // ReferenceError: if (false) { // i is not defined let i = 10;}

Page 31: Living in the ES6 Future, Today

block-scoped vars

if (false) { let i = 10;}console.log(i); // ReferenceError: // i is not defined

Page 32: Living in the ES6 Future, Today

block-scoped vars

for (let i = 0; i < 10; i++) { // do something}console.log(i); // ReferenceError: // i is not defined

Page 33: Living in the ES6 Future, Today

arrow functions

[1, 2, 3].map(function(i) { return i * i;});

Page 34: Living in the ES6 Future, Today

arrow functions

[1, 2, 3].map(i => i * i);

Page 35: Living in the ES6 Future, Today

arrow functions{ i: 1, printWithDelay: function() { setTimeout(function() { console.log(this.i); }, 100); }}

Page 36: Living in the ES6 Future, Today

arrow functions{ i: 1, printWithDelay: function() { var self = this; setTimeout(function() { console.log(self.i); }, 100); }}

Page 37: Living in the ES6 Future, Today

arrow functions{ i: 1, printWithDelay: function() { setTimeout(function() { console.log(this.i); }.bind(this), 100); }}

Page 38: Living in the ES6 Future, Today

arrow functions{ i: 1, printWithDelay: function() { setTimeout(_.bind(function() { console.log(this.i); }, this), 100); }}

Page 39: Living in the ES6 Future, Today

arrow functions{ i: 1, printWithDelay: function() { setTimeout( () => { console.log(this.i); }, 100); }}

Page 40: Living in the ES6 Future, Today

improved literals

return { name: name, age: age, height: height};

Page 41: Living in the ES6 Future, Today

improved literals

return { name, age, height };

Page 42: Living in the ES6 Future, Today

improved literals{ doAThing: function() { // ... },

doAnotherThing: function() { // ... }}

Page 43: Living in the ES6 Future, Today

improved literals{ doAThing() { // ... },

doAnotherThing() { // ... }}

Page 44: Living in the ES6 Future, Today

classesclass Demo { constructor() { this.i = 1; }

print() { console.log(this.i); }}

Page 45: Living in the ES6 Future, Today

classesclass Parent { //}

class Child extends Parent { constructor(name) { super(); this.name = name; }}

Page 46: Living in the ES6 Future, Today

Much, much morelet { top, left } = e.getClientRect();

function* gen() { yield 1; yield 2; }

for (i of gen()) { log(i); }

[ for (let i of [1, 2, 3]) i * i ];

var sq = ( for (let i of [1, 2, 3]) i * i );

for (let i of sq) { log(i); }

Page 47: Living in the ES6 Future, Today

I have softwareto ship to

REAL USERS

Page 48: Living in the ES6 Future, Today

Coming Soon(er)node.js

FirefoxOS

browser plugins

Windows 8

Page 49: Living in the ES6 Future, Today

What are myoptions?

Page 50: Living in the ES6 Future, Today

What can we use today?

Page 52: Living in the ES6 Future, Today

If we have

Page 53: Living in the ES6 Future, Today

If we haveCoffeeScript --> JavaScript

Page 54: Living in the ES6 Future, Today

If we haveCoffeeScript --> JavaScript

IcedCoffeeScript --> JavaScript

Page 55: Living in the ES6 Future, Today

If we haveCoffeeScript --> JavaScript

IcedCoffeeScript --> JavaScriptTypedScript --> JavaScript

Page 56: Living in the ES6 Future, Today

If we haveCoffeeScript --> JavaScript

IcedCoffeeScript --> JavaScriptTypedScript --> JavaScript

ClojureScript --> JavaScript

Page 57: Living in the ES6 Future, Today

Why not?JavaScript --> JavaScript

Page 58: Living in the ES6 Future, Today

Why not?JavaScript.next

--> JavaScript.now

Page 59: Living in the ES6 Future, Today

Traceur

Page 60: Living in the ES6 Future, Today

TraceurJavaScript --> JavaScript

Page 61: Living in the ES6 Future, Today

TraceurJavaScript --> JavaScript

...written in JavaScript

Page 62: Living in the ES6 Future, Today

DemoTime

Page 63: Living in the ES6 Future, Today

WAIT!what about modules?

Page 64: Living in the ES6 Future, Today

import { foo, bar } from "foobar";

function fooTheBar() { return foo + bar;}

export default = fooTheBar;

square/es6-module-transpiler

Page 65: Living in the ES6 Future, Today

ES6 all the things?

Page 66: Living in the ES6 Future, Today

@JeremyMorrellhttp://rathercurio.us

http://github.com/jmorrell

Thanks!


Top Related