dotJS 2017 - Wes Bos - Async + Await

  Рет қаралды 65,315

dotconferences

dotconferences

Күн бұрын

Пікірлер: 56
@owaissonija7339
@owaissonija7339 3 ай бұрын
If you are here from the Odin project, you did great job so far by being persistent. Best of luck ahead!
@thatmehdude
@thatmehdude Ай бұрын
feels like the end is still too far man.
@mridhulml3269
@mridhulml3269 Ай бұрын
yoo thank you! really needed that rn.
@mridhulml3269
@mridhulml3269 Ай бұрын
@@thatmehdude yea same...I'm considering jumping to full stack open after skimming through js section
@AmanSingh-vy5tk
@AmanSingh-vy5tk 20 күн бұрын
man lets connect we are not far from each-other in course road, hoping the learning is going good and job is not too far
@owaissonija7339
@owaissonija7339 20 күн бұрын
@@AmanSingh-vy5tk send your number/contact
@alexnezhynsky9707
@alexnezhynsky9707 6 жыл бұрын
Wes Bos delivering top notch quality content, as always 👏
@XIAOx
@XIAOx 2 жыл бұрын
that girl who's laying down there is a mood
@eiririiii
@eiririiii 8 ай бұрын
i think she is disabled?
@ajinkyax
@ajinkyax 7 жыл бұрын
Thanks for showing `await Promise.all(...)` :) @8:03
@SamuelCarreira
@SamuelCarreira 6 жыл бұрын
Great talk! All perfect: great comunication and support slides
@daniilpanov2194
@daniilpanov2194 Жыл бұрын
I didn't know that Ewan McGregor is an expert in JS. Good for him!
@stolensentience
@stolensentience 2 жыл бұрын
That .find() syntax at 10:59 where you feed it an object… is that a thing? I error out when I try it.
@DoctorFeral
@DoctorFeral 6 жыл бұрын
I was having breakfast while watching this :)
@jntlmb
@jntlmb Ай бұрын
is this a talk tuah reference?
@aaron8989
@aaron8989 2 жыл бұрын
The parameters within the catchErrors function (req, res, next) are specific parameters to the getOrders function. If I wanted to wrap another function inside catchErrors that took a different set of parameters, would I need to define a new catchErrors function with these parameters inside? Sorry if this is a stupid question but I'm fairly new to coding.
@YuriPolchenko
@YuriPolchenko 6 жыл бұрын
Thanks! Awesome explanation
@re.liable
@re.liable 2 жыл бұрын
that HOF is like a decorator right?
@muriukialex
@muriukialex 2 жыл бұрын
Great talk!
@baka_baca
@baka_baca 2 жыл бұрын
Awesome talk! Seeing async/await years on after this video was posted, I have a couple of thoughts. I still use the Promise.then quite frequently alongside async/await because it let's me use a point-free style which I find cleaner in many cases. Why bother with a bunch of intermediate variables for data processing when I can cleanly have something like this "fetchData().then(camelCase).then(sendJson(res)).catch(next)". Also async/await is awesome, but I've seen a lot of developers get confused with it and make mistakes they simply wouldn't when using Promise.then. From writing blocking code by using multiple awaits on data calls that don't depend on each other, writing things like this "return await fetchData();" which just isn't necessary, and skipping writing a catch altogether because they think they must use a try/catch block which can be clunky to read and write (i.e. now we have another layer of nesting, sometimes more) instead of using a Promise.catch. Basically, it seems like as soon as developers discover async/await they seem to think they MUST use it in all cases and must never touch a Promise.then or Promise.catch again. I use async/await all the time just like I use Promise.then/catch all the time, I just try to use async/await more sparingly. I use async/await when I'm synchronizing large amounts of custom logic and data calls that won't come out clean with Promise.then. And I use Promise.then when I can nicely write in a point-free style and when I want to make it more clear that I am in fact returning a Promise. I get how async functions automagically wrap the return statement in a Promise for me, but with that detail hidden away I've gotten tripped up, as well as many others, that a Promise is being returned and not what the code says is being returned (i.e. where's the Promise in this line "return { data: formattedData };").
@stolensentience
@stolensentience 2 жыл бұрын
Don’t you have to write .then as a callback i.e. .then(x => x.camelCase)
@rumax3440
@rumax3440 7 жыл бұрын
How to cancel await? You do a network request on button click and then user click it again, which will trigger new event and new await. Would be nice do describe such examples too.
@bharat9835
@bharat9835 7 жыл бұрын
rumax you would probably use throttle/debounce. If you really need cancelling you need to look at rxjs.
@JeanPatrickSmith
@JeanPatrickSmith 7 жыл бұрын
You can do a faux cancel by having something like: let status = 'good'; and in the response: if something else has happened, if (status === 'bad') > trash/ignore response, cache it, etc... very few cases where you should allow for that to happen. Like bharat said though if you actually need to cancel an async function mid stream, like for big data files or somethinig, than rxjs is your best bet. async/await is good for code readability and what not. In jQuery you can cancel ajax requests mid stream, and same with axios: medium.com/@muehler.v/node-js-meets-opencvs-deep-neural-networks-fun-with-tensorflow-and-caffe-ff8d52a0f072 So, depending on your library you can cancel manually, but async/await doesn't offer that out of the box.
@WesBos
@WesBos 7 жыл бұрын
A new AbortController() API is here / coming soon to cancel promises
@raphaelmarot8282
@raphaelmarot8282 6 жыл бұрын
Thanks!
@pierread1011
@pierread1011 6 жыл бұрын
Still not sold on the async/await thing. It was an interesting talk though, thanks for this!
@aNotoriousPhD
@aNotoriousPhD 6 жыл бұрын
opposed to what, .then chaining? Async/await is 10x more readable than .then's and callbacks.
@Textras
@Textras 6 жыл бұрын
Syntax.fm
@lasredchris
@lasredchris 5 жыл бұрын
flow control in javascript is hard promise - something that will happen in the future promise.all - wait for all those things to be done come back to it when we have the data what's the deal with then? asyc/await. substute for .then. We don't want to lock up the browser
@tilakmadichettitheappdeveloper
@tilakmadichettitheappdeveloper 3 жыл бұрын
when the bus says something, she-up-n-listen
@wepranaga
@wepranaga 5 жыл бұрын
the joke is a sink a weight
@tadeuasarro
@tadeuasarro 4 жыл бұрын
It took me some time
@stolensentience
@stolensentience 2 жыл бұрын
@@tadeuasarro hadda wait for it to uh, sink in?
@salwacoding5661
@salwacoding5661 3 ай бұрын
@@stolensentience Loool That got me laugh more than the original joke.
@lamme4049
@lamme4049 4 жыл бұрын
I'm actually shocked that people think that it's easier to use async/await than normal promises
@baka_baca
@baka_baca 2 жыл бұрын
Agreed, async/await seems like it should be easier glancing at the code, but there's a significant amount of stuff you just have to know and keep in your head while reading and writing it. I use it all the time, but more sparingly than the Promise.then pattern.
@stolensentience
@stolensentience 2 жыл бұрын
@@baka_baca learning curve is higher (arguably) but the readability is too
@schizo5189
@schizo5189 10 ай бұрын
It just means you don't really understand promise. If you understand promise well, async/await is just syntatic sugar over them. The semantic is not that different
@Minotauro_di_Chieti
@Minotauro_di_Chieti 4 жыл бұрын
This is not about async/awais, but axios!!
@stolensentience
@stolensentience 2 жыл бұрын
What.
The Async Await Episode I Promised
12:04
Fireship
Рет қаралды 1,1 МЛН
VIP ACCESS
00:47
Natan por Aí
Рет қаралды 26 МЛН
To Brawl AND BEYOND!
00:51
Brawl Stars
Рет қаралды 16 МЛН
Netflix JavaScript Talks - RxJS + Redux + React = Amazing!
37:14
Netflix Engineering
Рет қаралды 395 М.
Wes Bos - Get better at JavaScript with just JavaScript
42:15
Jamstack TV
Рет қаралды 51 М.
Advanced Async and Concurrency Patterns in JavaScript
39:43
Hack Reactor
Рет қаралды 141 М.
Clean Code - Uncle Bob / Lesson 4
1:30:36
UnityCoin
Рет қаралды 314 М.
JavaScript Pro Tips - Code This, NOT That
12:37
Fireship
Рет қаралды 2,5 МЛН
🚀  TDD, Where Did It All Go Wrong (Ian Cooper)
1:03:55
DevTernity Conference
Рет қаралды 571 М.
Async Await vs. Promises - JavaScript Tutorial for beginners
24:30
VIP ACCESS
00:47
Natan por Aí
Рет қаралды 26 МЛН