"Week four is the worst you are going to feel," was how my teacher put it. Material wise, we were informed that week four is the last week of introducing large concepts. By mid-week, I felt I had a good handle on asynch, but approaching Friday, I think my brain had flooded with too much information and I had to back-peddle a little to get more clarity. Going into the weekend, I felt a lot less shaky and challenged myself to complete our homework project not only with the new concepts below, but to style with Sass because it seemed like a fun opportunity to do so. (And, it was! 👏)
We entered the wonderful world of asynchronous programming. We learned about Promises and applied them to make requests to various APIs. We also worked with routing and setting an EventListener on the Window object.
Workflow looks basically the same each time:
- Create Promise statement with
.then(someFunction)to say when I return with XYZ data, then run some function to do stuff.
- Iterate through array of returned data objects
- Use a function to generate HTML strings to populate the page with data
Additionally, for searches:
- Build search functionality listening for user input on hashchange.
- Route to correct new URL (following hash
We watched this video about the event loop, and I like his visuals for illustrating callbacks and what happens with the Web API (specifically minutes 12:00-15:00):