Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Locked learning resources

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Timers and Files (Summary)

Well done on finishing Timers and Files.

In this course, you learned how to:

  • Run code later without freezing the page, and write functions that remember their own variables
  • Schedule, repeat, and cancel timers, and count down from a deadline on the page
  • Split text into fields, and fetch JSON and CSV files from the page’s server
  • Read a file the user picks, check it, and save a new file for them to keep
  • Load data files the app ships with, let users export and import their data, and add timers and timed feedback to a page

In the video, Sam’s finished box goes into the kitchen:

What Sam does What Sam’s box shows
Opens the box for the first time The four starters from data/recipes.json, each with its steps, and No saved recipes yet. Showing the starter recipes.
Starts Simmer, then Boil the eggs Both lines counting down at once, such as Simmer: 24:54 left and Boil the eggs: 5:55 left
Adds Shakshuka A fifth row and Shakshuka added. Saved., which fades and is gone two seconds later
Types egg into Filter One redraw once the typing stops: Soft-boiled eggs, 1 recipe shown., and its timer still counting
Picks ayumi.csv in Import a recipe list Ayumi’s three recipes, checked first, and 3 recipes imported from ayumi.csv. Saved.
Clicks Export a backup Chrome saves a new file, recipe-box-backup.json, and the page doesn’t change

Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Locked learning resources

The full lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

00:00 Well done on finishing Timers and Files. In this course, you learned how to run code later without freezing the page, and write functions that remember their own variables.

00:11 How to schedule, repeat, and cancel timers, and count down from a deadline on the page. How to split text into fields, and fetch JSON and CSV files from the page’s server.

00:22 How to read a file the user picks, check it, and save a new file for them to keep. And how to load data files the app ships with, let users export and import their data, and add timers and timed feedback to a page.

00:37 Here’s Sam’s finished box. Sam starts Simmer, then Boil the eggs. Each counts down from its own deadline, kept in its own closure.

00:47 Sam adds Shakshuka, and Saved clears itself two seconds later. Filter redraws the list once, when Sam stops typing. The starters came from a data file on the server.

01:00 Ayumi’s list comes from a file Sam picks, checked first. And Export hands Sam a new backup file.

01:09 Here’s what to remember. setTimeout doesn’t pause your code. A function made inside a call keeps that call’s variables. Each timed job gets one timer ID, and countdowns use a deadline.

01:21 Fetch doesn’t throw on a 404, so check response.ok. And a page sees only the files on your computer that you pick, so check them.

01:32 Below this video, you’ll find two roadmaps, for frontend and full stack work.

01:38 Sam’s box is ready for the kitchen. Next, you’ll build a trip packing list from start to finish. Thanks for watching.

Become a Member to join the conversation.