Change location for data files

This commit is contained in:
Kamran Ahmed committed 2023-02-21 12:25:58 +00:00
1 parent b741a0e1ee
commit b6a0255f12
2772 files changed
+30 -30

No files matched your search

@@ -0,0 +1,11 @@
# Event Loop
The Event Loop is one of the most critical aspects of Node.js. Why is this so important? Because it explains how Node.js can be asynchronous and have non-blocking I/O, it explains the "killer feature" of Node.js, which made it this successful.
Visit the following resources to learn more:
- [The Node.JS Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#what-is-the-event-loop)
- [JavaScript Visualized: Event Loop](https://dev.to/lydiahallie/javascript-visualized-event-loop-3dif)
- [The Node.js Event Loop](https://www.coursera.org/lecture/secure-full-stack-mean-developer/the-node-js-event-loop-j5fbT)
- [The Complete Node js: The Node js Event Loop](https://www.youtube.com/watch?v=6YgsqXlUoTM)
- [The NodeJS Event loop](https://nodejs.dev/en/learn/the-nodejs-event-loop/)
@@ -0,0 +1,8 @@
# Event Emitter
In Node.js, an event can be described simply as a string with a corresponding callback. An event can be "emitted" (or, in other words, the corresponding callback be called) multiple times or you can choose to only listen for the first time it is emitted.
Visit the following resources to learn more:
- [What are Event Emitters?](https://nodejs.dev/en/learn/the-nodejs-event-emitter/)
- [Using Event Emitters in Node.js](https://www.digitalocean.com/community/tutorials/using-event-emitters-in-node-js)
@@ -0,0 +1,18 @@
# Promises
A promise is commonly defined as a proxy for a value that will eventually become available
Asynchronous functions use promise behind the scenes, so understanding how promises work is fundamental to understanding how "async" and "await" works.
Once a promise has been called, it will start in a pending state. This means that the calling function continues executing, while the promise is pending until it resolves, giving the calling function whatever data was being requested.
Creating a Promise:
The Promise API exposes a Promise constructor, which you initialize using newPromise().
Using resolve() and reject(), we can communicate back to the caller what the resulting Promise state was, and what to do with it.
Visit the following resources to learn more:
- [Promise Methods](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
- [Official Website](https://www.promisejs.org/)
- [Official Website](https://www.freecodecamp.org/news/javascript-promises-for-beginners/)
- [Asynchronous JavaScript - Promises](https://www.youtube.com/watch?v=a_8nrslImo4/)
@@ -0,0 +1,11 @@
# Async/Await
Async/Await is a special syntax to work with promises in a more comfortable fashion. It's easy to understand and use. Adding the keyword async before a function ensures that the function returns a promise and the keyword await makes JavaScript wait until that promise settles and returns the result.
Visit the following resources to learn more:
- [Official Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function)
- [More on async await](https://javascript.info/async-await)
- [Using async await](https://www.youtube.com/watch?v=V_Kr9OSfDeU)
- [W3Docs Async/Await](https://www.w3docs.com/learn-javascript/async-await.html)
- [Difference between Promise and Async/Await](https://www.geeksforgeeks.org/difference-between-promise-and-async-await-in-node-js/)
@@ -0,0 +1,8 @@
# Callbacks
Node.js, being an asynchronous platform, doesn't wait around for things like file I/O to finish - Node.js uses callbacks. A callback is a function called at the completion of a given task; this prevents any blocking, and allows other code to be run in the meantime.
Visit the following resources to learn more:
- [What are callbacks?](https://developer.mozilla.org/en-US/docs/Glossary/Callback_function)
- [Asynchronicity in Programming Languages](https://nodejs.dev/en/learn/javascript-asynchronous-programming-and-callbacks/)
@@ -0,0 +1,10 @@
# setTimeout
The setTimeout runs a function after the specified period expires. Times are declared in milliseconds.
Visit the following resources to learn more:
- [JavaScript MDN Docs](https://developer.mozilla.org/en-US/docs/Web/API/setTimeout)
- [W3Schools – JavaScript - setTimeOut](https://www.w3schools.com/jsref/met_win_settimeout.asp)
- [setInterval and setTimeout: timing events](https://www.youtube.com/watch?v=kOcFZV3c75I)
- [setTimeout EXPLAINED in 5 minutes!](https://www.youtube.com/watch?v=z9lJb4D3nJY)
@@ -0,0 +1,10 @@
# setInterval
The `setInterval()` method helps us to repeatedly execute a function after a fixed delay. It returns a unique interval ID which can later be used by the `clearInterval()` method, which stops further repeated execution of the function.
`setInterval()` is similar to setTimeout, with a difference. Instead of running the callback function once, it will run it forever, at the specific time interval you specify (in milliseconds):
Visit the following resources to learn more:
- [Scheduling: setTimeout and setInterval](https://javascript.info/settimeout-setinterval)
- [What is the use of setInterval() method in Node.js?](https://www.geeksforgeeks.org/what-is-setinterval-in-javascript/)
@@ -0,0 +1,8 @@
# setImmediate
The `setImmediate` function delays the execution of a function to be called after the current event loops finish all their execution. It's very similar to calling `setTimeout` with 0 ms delay.
Visit the following resources to learn more:
- [Understanding setImmediate](https://developer.mozilla.org/en-US/docs/Web/API/Window/setImmediate)
- [Understanding setImmediate](https://nodejs.dev/en/learn/understanding-setimmediate/)
@@ -0,0 +1,9 @@
# process.nextTick()
Every time the event loop takes a full trip, we call it a tick. When we pass a function to `process.nextTick()`, we instruct the engine to invoke this function at the end of the current operation before the next event loop tick starts.
Visit the following resources to learn more:
- [Understanding Process.NextTick()](https://nodejs.dev/en/learn/understanding-processnexttick/)
- [The Node.js process.nextTick()](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/)
- [The process.nextTick Function](https://www.youtube.com/watch?v=-niA5XOlCWI)
@@ -0,0 +1,8 @@
# Nodejs async programming
Asynchronous code means that things can happen independently of the main program flow, async functions in JavaScript are processed in the background without blocking other requests. It ensures non-blocking code execution. Asynchronous code executes without having any dependency and no order. This improves the system efficiency and throughput. Making web apps requires knowledge of asynchronous concepts since we will be dealing with actions that require some time to get processed.
Visit the following resources to learn more:
- [Introduction to Async JS](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Asynchronous/Introducing/)
- [Asynchronous Vs Synchronous Programming](https://www.youtube.com/watch?v=Kpn2ajSa92c)