-
Notifications
You must be signed in to change notification settings - Fork 11
Async
Melissa Stock edited this page May 15, 2019
·
1 revision
- The first argument of the callback is reserved for an error object.
- The second argument of the callback is reserved for any successful response data
- JS is broken down into two components: one that runs now and one that runs later
- Whenever there is an event, the event loop runs until the queue is empty
- JS can only run one event from the queue at a time
- Concurrency is when two events interleave over time, given a simultaneous appearance
- We use callback functions to manage async
- JS is single threaded however how the thread is compiled (the call stack) is very different then how our brains think
- Promises are used to help inversion control problems created by callbacks
- Promises help close the gap between how our brains organize the call stack and how it is actually done by the program