#what is an event loop? this vid
- JS
- heap - where mem allocation happens
- call stack (in chrome it's essentialy v8) - where stack frames are
- --> look to...
- web apis - extra things the browser provides
- dom
- ajax
- setTimeout
- etc
- --> look to...
- callback queue
- onLcick
- onLoad
- onDone
- event loop
###the call stack one thread === one call stack === one thing at a time
- js is single-threaded programming language
- can only push off the top, pop off the top
- 'blowing the stack' -- when you hit max call stack size. ex misused recursion.
###blocking what happens when things are slow?
- ex three synchronous network requests that are slow, block things after it.
- blocking is a problem because we're running code in browswers, and we can't do anything in browsers if the call stack has things on it.
###asnchronous callbacks
- solution for synchronous blocking
###concurrency and the event loop one thing at a time, except not really
- js can move things from the stack that are 'taking time' and put them in the web api provided by the browser, thereby clearing the stack a little
- when web apis are done, they push event to task queue
- event loop's job: look at stack and look at task queue. if stack is empty, it takes first thing on the queue and and pushes it onto the stack which effectively runs it.