1_how_to_use_promises
dz / mdn / js / 3_async_javascript / 1_how_to_use_promisesSummary
How to use promises
Node Tree
Nodes
| promises | |
| content | promises |
| children | catching_errors, chaining_promises, fetch_API, foundation_async_programming, handlers_attach_promise, obj_ret_async_cur_state (description) |
| foundation_async_programming | |
| content | foundation of asynchronous programming in JavaScript |
| parents | promises |
| obj_ret_async_cur_state | |
| content | Object returned by an asynchronous function which represents the current state of operation |
| parents | promises |
| handlers_attach_promise | |
| content | handlers attached to promise object are executed when oepration succeeds/fails |
| parents | promises |
| fetch_API | |
| content | fetch() API |
| children | promise_replacement_XMLHttpRequest (description) |
| parents | promises |
| promise_replacement_XMLHttpRequest | |
| content | promise-based replacement for XMLHttpRequest |
| parents | fetch_API |
| chaining_promises | |
| content | Chaining Promises |
| children | promise_chaining, then_returns_promise |
| parents | promises |
| promise_chaining | |
| content | Promise Chaining: return promise, call then() on it. |
| parents | chaining_promises |
| then_returns_promise | |
| content | then() itself returns a promise, which will be completed with the result of the function passed to it. |
| parents | chaining_promises |
| catching_errors | |
| content | catching errors |
| children | catch_method |
| parents | promises |
| catch_method | |
| content | catch() method |
| children | called_on_any_failure_when_at_end |
| parents | catching_errors |
| called_on_any_failure_when_at_end | |
| content | when placed at end of chain, will be called when any of the asynchronous functions fail |
| parents | catch_method |
| promise_terminology | |
| content | Promise terminology |
| children | rejected, settled, fulfilled, pending |
| pending | |
| content | pending: promise created, async function created with it has yet to succeed or fail |
| parents | promise_terminology |
| fulfilled | |
| content | Fulfilled: async function suceeded, then() handler called |
| parents | promise_terminology |
| rejected | |
| content | Rejected: async func failed. Catch() handler called. |
| parents | promise_terminology |
| combining_multiple_promises | |
| content | Combining mUltiple promises |
| children | promise_all |
| promise_all | |
| content | promise.all(): takes array of promises and returns single promise |
| children | promise_all_fulfilled_rejected, promise_any (fulfilled when any promise in array fulfilled) |
| parents | combining_multiple_promises |
| settled | |
| content | Settled: covers both fulfilled and rejected |
| parents | promise_terminology |
| promise_all_fulfilled_rejected | |
| content | fulfilled when and if all promises fulfilled. rejected when and if any are rejected. |
| parents | promise_all |
| promise_any | |
| content | promise.any(): like promise.all(), but fulfilled when any promises in array are fulfilled |
| parents | promise_all |
| async_await | |
| content | Async and Await |
| children | async, await |
| await | |
| content | await: used inside async function before function call that returns promise. |
| children | similar_to_promise_chain, make_async_look_sync (description), only_used_async_or_module |
| parents | async_await |
| async | |
| content | async: keyword before function declaration to make it asynchronous. |
| parents | async_await |
| make_async_look_sync | |
| content | Enables code using async functions to look like synchronous code |
| parents | await |
| only_used_async_or_module | |
| content | Only used in async function, unless code is inside a JS module |
| parents | await |
| similar_to_promise_chain | |
| content | similar to promise chain, await forces async operations to be completed in series |
| parents | await |