282. Loading a Recipe from API
async/fetch
after making markup html code
284. Listening for load and hashchange events
dynamic id after removing '#' with slice(1)
ev will change hash and then will be loaded
285. The MVC architecture
286. Refactoring for MVC
1- refactoring to handle state in model
loadReciple() is async function so needs wait
and by destructing {recipe}, can keep the code
in controller, (model.state.recipe) pass with render
in View, so that recipe,in controller, refers this.#data
add babelrc to use private variable
[mistake] this.#generateMarkup() & img source path
3. fractional to handle number thing
and replace ingrdient to ing
287. Helpers and Configuration
config.js for allowing us to configure by changing some of the data like API_URL
helpers.js is to contain a couple of function that we reuse like getJSON()
in Model.js
in helpers.js
we need to return data so (this data) will become the resolved value of this promise
we want to handle the error in model.js. So, we have to re-throw the error
promise.race() will decide to resolve or reject and if timeout_sec pass, then error show up
288. Event Handlers in MVC: publisher and subscriber pattern
controller
views, passing controlRecipes() function as handler
289. Implementing Error and Success Messages
throw err in model and then
in controller
recipeView.renderError(); // to display error in view
create renderError() and renderMessage() to handle that msg function
290. Implementing search Part 1
store all recipes search data into state
control handles the search result
291. Implementing search Part 2
after chaning from #private to _protected,
extracting common View code from recepiceView,
Displaying renderringSpinner without writing a new code
where is the search result data?
in the View.js render()
292. Implementing pagination Part 1
from model
Set start and end like 0 -10
in controller
& set page state
293. Implementing pagination Part 2
use that number to render the results
'const goToPage = +btn.dataset.goto'
+ sign convert to number type
294. Project Planning II
4. Change servings functionality
5. Bookmarking funcitonality
6. Store bookmark data in the browser
7. On page load, read saved bookmarks
295. Updating recipe servings
update entire view with the new state
to connect with the UI, use data-sth
updating the serving number with updateTo
296. Developing a DOM updating algorithm
297. Implementing Bookmark - Part 1
298. Implementing Bookmark - Part 2
299. Storing bookmarks with localStorage
300. Project planning III
301. Uploading a new Recipe - Part 1
302. Uploading a new Recipe - Part 2
303. Uploading a new Recipe - Part 3
304. Final wrapping up
Comments
Post a Comment