async e await com javascript: entenda e use agora
TRANSCRIPT
w w w . l a m b d a 3 . c o m . b r
Async e Await
entenda e use agora!
Giovanni Bassi•Programador
•MVP
•Não gerente
• Trouxe a Scrum.org, PSM e PSD pro Brasil
•blog.lambda3.com.br, podcast.lambda3.com.br, dotnetarchitects.net, nodebr, dockersp
•@giovannibassi
• Escalador e ciclista
podcast.lambda3.com.br
0 – Eventos1 – Docker2 – .NET Core RC23 – Git4 – Estudo5 – Open Source6 – Xamarin7 – Node.js8 – Democracia organizacional9 – O programador poliglota...
Toda semana em:
Callbacks
Promises com bibliotecas
(q, bluebird, etc)
Promises e Generators
Async/Await
EcmaScript 1
(ES1 - 1997)
2010
EcmaScript 2015 (ES6)
EcmaScript 2017 (ES8)
Function ExpressionsEcmaScript 3
(ES3 - 1999)
function* fibonacci() {let [fn1, fn2] = [0, 1];while (true) {
yield fn1;[fn1, fn2] = [fn2, fn2 + fn1];
}}
for (const n of fibonacci()) {if (n === 927372692193079200000) break;process.stdout.write(`${n} `);
}
async function f1(){await f3();
}
const f3 = async() => await f2;
const f2 = async function (){await f1();
}
tc39.github.io/ecma262/2017/#sec-async-function-definitions
github.com/tc39/ecmascript-asyncawait
github.com/giggio/asyncawaitsamples
w w w . l a m b d a 3 . c o m . b r
Dúvidas?
w w w . l a m b d a 3 . c o m . b r
Obrigado!