Event loops and the asynchronous programming in Javascript¶
This STS is based on the importance of Asynchronous programming in Javascript and how Javascript actually works, how it executes callbacks and handles asynchronous code. It will also cover how to use Callbacks, Promises and Async Await effectively in your code. This session will also cover little bit about the concept of Generators in javaScript.
Links¶
Introduction¶
The session is divided into three sections. The first section will cover how event loops and call stack work in JavaScript. The Second section will cover how to write non-blocking and asynchronous code in JavaScript and how to use Promises, call backs and Async-Await effectively and then the last section will cover the concept of Generators in Javascript.
WHY Event Loops and Call Stack ?¶
Call stacks and event loops are very important and it helps you understand how Javascript actually runs on browser and node. It also helps you in understanding how callbacks are actually handled in JavaScript.
WHY Aysnc Await ?¶
ES 2017 introduced Asynchronous functions. Async functions are essentially a cleaner way to work with asynchronous code in JavaScript.
Here are some important points to remember:
- Async/await is a new way to write asynchronous code. Previous options for asynchronous code are callbacks and promises.
- Async/await is actually built on top of promises. It cannot be used with plain callbacks or node callbacks.
- Async/await is, like promises, non blocking.
- Async/await makes asynchronous code look and behave a little more like synchronous code. This is where all its power lies.
WHY Generators ?¶
Generators are functions that you can use to control the iterator. They can be suspended and later resumed at any time.
So if you wanna do something in your function which involves stopping it and perform other operations and then resume that function again, you should learn how to use Generators.
STS Date¶
04 - AUG - 2017
STS Duration¶
30-45 Mins
STS Slides¶
STS Snacks are on the house¶
Donuts !