In this video, explore the code walk-through of implementing static file caching into the cache, opened in the previous video, using local-first approach but with explanations about how to do remote-first if needed.
- Now that we have opened the caches … for our CSS files, and images, … we need to tell the caches which files to cache. … To do this, we're going to create another constant … called cache files, which will store an object in. … In there, we're going to create the same keys … as the names of the caches that we created earlier. … Each key will contain an array of the files … that we want to cache. … Now you can get a list of all the CSS files being included. … By having a look in the HTML, … I've pre prepared my list. … We can do the same for the images cache, … as we've done for the CSS cache, … and put in a array of all of the images … that are being used in the application. … Once we've got our arrays, … we can then store those files in the cache, … which got down to the caches dot open that we did earlier. … Here, we can return a call to cache dot add all. … This allows us to add lots of files in one go … by providing an array of the file locations. … So here we can do cache files, dot CSS. …
Skill Level Advanced
Web Programming Foundationswith Morten Rand-Hendriksen58m 44s Beginner
1. Front-End Performance Tools
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.