ES6 ECMA2015

Post on 15-Apr-2017

495 Views

Category:

Software

0 Downloads

Preview:

Click to see full reader

Transcript

ES6ECMA 2015

ES6 Compatibility

https://kangax.github.io/compat-table/es6/

This tutorial uses Babel + Polyfills

Babelnpm install —save-dev babel-cli

npm install babel-preset-es2015npm install babel-preset-stage-0

.babelrc

npm

babel src -d out

“babel-cli” : “^6.5.1”

npm run build

WebStorm

watches JS files, transpiles them on the spot.

String Template & Interpolation

` ${val} `

Decompose

Array & Map

let of to iterate an array or a map

Arrow Function (Lambda)( param1, param2 ) => { statements}

High Order Functionsmap, filter, forEach

Class

Export & Importimport {func} from ‘filename’

import * as xxx from

This needs to point to the compile code.

Promisesreplace Callbacks with Promises.

Chain of Promises

Promises

Wait for all the promises done.

Generators (yield)

npm install babel-polyfill

Generators

let us invoke async functions synchronously.

or

randevu

top related