Add promises resources (#1753)
parent
c75c15ba13
commit
56a0d07c1f
1 changed files with 19 additions and 1 deletions
@ -1 +1,19 @@ |
|||||||
# Promises |
# Promises |
||||||
|
|
||||||
|
A promise is commonly defined as a proxy for a value that will eventually become available |
||||||
|
Asynchronous functions use promise behind the scens, 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. |
||||||
|
|
||||||
|
<ResourceGroupTitle>Free Content</ResourceGroupTitle> |
||||||
|
|
||||||
|
<BadgeLink colorScheme='yellow' badgeText='Read' href='https://nodejs.dev/en/learn/understanding-javascript-promises/'>Understanding Javascript Promises</BadgeLink> |
||||||
|
<BadgeLink colorScheme='yellow' badgeText='Read' href='https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise'>Promise Methods</BadgeLink> |
||||||
|
<BadgeLink colorScheme='blue' badgeText='Read' href='https://www.promisejs.org/'>Official Website</BadgeLink> |
||||||
|
<BadgeLink colorScheme='green' badgeText='Read' href='https://www.freecodecamp.org/news/javascript-promises-for-beginners/'>Official Website</BadgeLink> |
||||||
|
<BadgeLink badgeText='Watch' href='https://www.youtube.com/watch?v=a_8nrslImo4/'>Asynchronous JavaScript - Promises</BadgeLink> |
||||||
|
|
||||||
|
Loading…
Reference in new issue