mdn/js/3_async_javascript/0_introducing_async_javascript

0_introducing_async_javascript

dz / mdn / js / 3_async_javascript / 0_introducing_async_javascript

Summary

Introducing Asynchronous Javascript

Node Tree

Nodes

async_programming
content Asynchronous Programming: a technique that enables programs to start a potentially long-running task while still being responsive to other elements.
children event_handlers

sync_programming
content Synchronous Programming
children long_running_sync_fun_unresponsive

long_running_sync_fun_unresponsive
content Long-running synchronous functions will cause programs to be unresponsive
parents sync_programming

event_handlers
content event handlers
children event_handler_is_callback, form_async_programming
parents callbacks, async_programming

form_async_programming
content form of asynchronous programming
parents event_handlers

XMLHttpRequest
content XMLHttpRequest API: allows Http request to remote server. can attach event listeners to notify when done.

callbacks
content callbacks
children cb_code_difficult_to_understand, event_handler_is_callback, event_handlers, func_passed_into_func (description), modern_apis_use_promises, callback_hell

event_handler_is_callback
content An event handler is a kind of callback
parents callbacks, event_handlers

func_passed_into_func
content Function passed into another function, with the expectation that it will get called at the appropritae time
parents callbacks

cb_code_difficult_to_understand
content callback-based code can get hard to understand when the callback itself has to call functions that accept a callback
children common_if_op_breaks_into_async_funcs
parents callbacks

callback_hell
content Callback Hell / pyramid of doom: deeply nested callbacks
children modern_apis_use_promises (promises avoid callback hell)
parents callbacks

common_if_op_breaks_into_async_funcs
content Common if you need to perform operation that breaks into series of asynchronous functions
parents cb_code_difficult_to_understand

modern_apis_use_promises
content Modern asynchronous APIs used promises instead of callbacks
parents callback_hell, callbacks