Converting Callback Functions to Promises

  Рет қаралды 7,335

Steve Griffith - Prof3ssorSt3v3

Steve Griffith - Prof3ssorSt3v3

Күн бұрын

Пікірлер: 30
@Horse-tradeEu
@Horse-tradeEu 3 жыл бұрын
This channel is underrated. Has no click bates, fancy previews and the quality of the content is amazing. Thank you Steve!
@rmnkot
@rmnkot 3 жыл бұрын
completely agree!!!
@simple8810
@simple8810 3 жыл бұрын
true he is gem,I wanna share this channel on social media to support this man,and so that everyone get advantages
@sinxenon3181
@sinxenon3181 Жыл бұрын
I fell in love with your voice! Also the video is very clean and helpful! Thank you!
@gyros9162
@gyros9162 3 жыл бұрын
This is just a spectacular channel! He explains complicated stuff in a very succinct and professional manner.
@akmalshareef4785
@akmalshareef4785 2 жыл бұрын
Thank you for the clear and concise video. This deserves more views
@zb2747
@zb2747 Жыл бұрын
Love your channel
@kriscollins1541
@kriscollins1541 2 жыл бұрын
This is explained so well, thank you very much
@marcscherzer
@marcscherzer 3 жыл бұрын
Next : convert your promises to async-await
@allezzthepunk
@allezzthepunk 3 жыл бұрын
Very useful information
@Genocidechaos
@Genocidechaos 2 жыл бұрын
Thank you very much. In the then() chaining we could add an optional function for reject correct?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 2 жыл бұрын
Sure
@Konstantin19877
@Konstantin19877 2 жыл бұрын
good content!
@omega.developer
@omega.developer 3 жыл бұрын
very nice explaination..
@jabed-web-dev
@jabed-web-dev 3 жыл бұрын
Sir, please give a video about Node JS Async Hooks Module.
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 3 жыл бұрын
Please add any tutorial requests in the comments here - kzbin.info/www/bejne/gnTIq5SuZ9qBacU. - and vote for others that you like.
@Dr.smileclinic
@Dr.smileclinic Жыл бұрын
Can you explain callback to async function
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 Жыл бұрын
Callbacks are the same regardless of what kinds of function you are calling. It doesn't matter if they are synchronous or asynchronous. The purpose of a callback function is to be called after the current function is complete. Since they don't return to the current function when they are done it doesn't matter if they are async. function start( theCallBackFunc ){ //do a bunch of things //then call the callback when complete theCallBackFunc( ); }
@rickyu1978
@rickyu1978 3 жыл бұрын
passing in resolve in to a setTimeout .. is resolve itself a function? normally i see setTimeout(function() ..... Also, your catch, you wrote console. error, should it have been console.log(err) ? or perhaps console.error(err) .. Thank you
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 3 жыл бұрын
Resolve is a function so it can be passed to the setTimeout as the function to call. Console has many methods. Error warn info log and more. The catch method expects a function. So console.error is the function being passed in.
@ioannis2000
@ioannis2000 3 жыл бұрын
The dark forces of callback function brought chaos over the lines of resistance code. Then the Jedi Master Steve Griffith come with Promises and the Light won over darkness
@mocococo2877
@mocococo2877 2 жыл бұрын
Thank you again and again greetings from Bulgaria. Please help me once more Master Griffith to understand something that looks so trivial but yet eludes me. Please explain why you (and many other authors / developers) use anonymous intermediate functions to call the callbacks. Well, your example is a bit different but I hope you understand what I mean in general. someAsyncFn(() => { - here those functions I mean nextAsyncFn(() => { - here those functions I mean ............ What about using them directly. Like: someAsyncFn( nextAsyncFn( ............ I have seen examples of those too. So what is the difference ? Thank you.
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 2 жыл бұрын
Using this example from my code: delay(delay1) .then(() => changeBtnColor()) //return value gets passed to the next then() .then((d) => delay(d)) It could also be written like this: delay(delay1) .then( changeBtnColor ) //return value gets passed to the next then() .then( delay ) Both do the exact same thing. Normally I would add the extra anonymous function if there were a couple of lines of code to add. In this example, it was just to keep the appearance consistent and it is easier for junior devs to understand.
@mocococo2877
@mocococo2877 2 жыл бұрын
@@SteveGriffith-Prof3ssorSt3v3 Once again the Jedi Master Steve Griffith came to the rescue to one of his students as he was surrounded by dark and DECEIVING forces of JavaScript. For more info where the story began - look for IoannisX down below . This one sentence was the key. "Normally I would add the extra anonymous function if there were a couple of lines of code to add." Thank you.
@HarshKapadia
@HarshKapadia 3 жыл бұрын
Why do you use the 'DOMContentLoaded' event rather than the 'load' event? As always, thanks for the video, Steve!
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 3 жыл бұрын
Because the DOMContentLoaded event fires after the HTML has been read. The load event waits for the CSS, JavaScript, images, fonts, media, etc. The time delay for the load event can be much greater than DOMContentLoaded.
@HarshKapadia
@HarshKapadia 3 жыл бұрын
@@SteveGriffith-Prof3ssorSt3v3 aah okay. Thank you!
@CastleShield
@CastleShield 3 жыл бұрын
Truncating Text Inside Elements with CSS or JS
22:28
Steve Griffith - Prof3ssorSt3v3
Рет қаралды 4,6 М.
Async JavaScript & Callback Functions -- Tutorial for Beginners
24:21
UFC 287 : Перейра VS Адесанья 2
6:02
Setanta Sports UFC
Рет қаралды 486 М.
Thank you mommy 😊💝 #shorts
0:24
5-Minute Crafts HOUSE
Рет қаралды 33 МЛН
요즘유행 찍는법
0:34
오마이비키 OMV
Рет қаралды 12 МЛН
How to Use the New JS Object GroupBy Method
18:17
Steve Griffith - Prof3ssorSt3v3
Рет қаралды 4 М.
Error First Callback Patterns in JS
10:03
Steve Griffith - Prof3ssorSt3v3
Рет қаралды 5 М.
Tips For Using Async/Await in JavaScript
16:26
James Q Quick
Рет қаралды 397 М.
Understanding the Event Loop Sequence of Tasks
13:30
Steve Griffith - Prof3ssorSt3v3
Рет қаралды 6 М.
What are JavaScript PROMISES? 🤞
12:37
Bro Code
Рет қаралды 91 М.
Ten Steps to Mastering the Fetch API
2:19:52
Steve Griffith - Prof3ssorSt3v3
Рет қаралды 51 М.
JavaScript Visualized - Promise Execution
8:42
Lydia Hallie
Рет қаралды 203 М.
C++ Super Optimization: 1000X Faster
15:33
Dave's Garage
Рет қаралды 334 М.
UFC 287 : Перейра VS Адесанья 2
6:02
Setanta Sports UFC
Рет қаралды 486 М.