-
Synchronous vs Asynchronous
-
Turn and Talk: What are some situations where synchronous and asynchronous schemes occurr?
- Think of programming and non programming examples
-
Aside: The JS event loop
- Draw this on the board with help from students
-
Stuff that is async
- DOM events
- setTimeout
- setInterval
- Promises
- Fetch/XHR
- setState
-
How you know async stuff to work now: Callbacks
- Call for real life examples of callbacks (starbucks)
-
What's the problem with callbacks?
- Call for suggestions here
-
Promises: They solve the problems with callbacks
- Three States
- Pending
- Resolved
- Rejected
- The promise lifecycle
- Chaining Promises
- Promise methods - group up then present
- Promise.all()
- Promise.prototype.catch()
- Promise.prototype.then()
- Promise.race()
- Promise.reject()
- Promise.resolve()
- Three States
-
window.fetch example
- Use window.fetch to grab some data
Created
May 8, 2018 03:03
-
-
Save lalunamel/4d5f7e8d309bd1388992944c4a0e2d50 to your computer and use it in GitHub Desktop.
Turing - Promises Lesson
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment