Loading video player…

Timers and Files (Overview)

Welcome to Timers and Files. Real apps run code later and share data as files, and in this course, you teach your page both.

In the video, you saw Sam’s recipe box, ready for the kitchen. Until now, Sam watched the clock, and the recipes were stuck in one browser. Your finished box keeps time on its cooking steps and moves recipes in and out as files:

What Sam does What Sam’s finished box shows
Opens the box for the first time The four starter recipes, which came with the app as a data file, each with its steps
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
Picks a friend’s plain recipe list from the computer The three new recipes, and 3 recipes imported from ayumi.csv. Saved.
Clicks Export a backup A new file, recipe-box-backup.json, in the browser’s downloads

By the end of this course, you’ll know 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

Before You Start

You need the JavaScript basics, including objects and arrays of objects, and you should know how a page saves its data in the browser and redraws a list. Sam’s recipe box is that kind of page, and it’s where this course starts. The box as this course starts is in the course’s Sample Code download, folder 01-why-async/recipes-start, ready to open. Each exercise gives you starting code. You also need:

  • A current version of Chrome or Edge
  • A code editor
  • A local server, such as Live Preview in your editor

How This Course Works

The course has four sections: Code That Runs Later, Timers on the Page, Loading Data Files, and Files the User Picks. Each section mixes text lessons and videos, and ends with an exercise you solve in the browser, with automated tests that check your code.

In the project, A Kitchen-Ready Recipe Box, you finish Sam’s box in three exercises, then explain it in a chat with the AI mentor. A quiz and a summary close the course.

If your code waits for Sam’s eggs, what happens to the page? First up is Run Code Later Without Freezing, where you find out.

Download

Course Slides (.pdf)

847.3 KB
Download

Sample Code (.zip)

45.0 KB

00:00 Welcome to Timers and Files. Real apps run code later and share data as files, and you’ll teach your page both.

00:09 Here’s Sam’s recipe box, ready for the kitchen. Until now, Sam watched the clock, and the recipes were stuck in one browser.

00:18 Sam starts Simmer, then Boil the eggs, and both count down at once. The starters came with the app, as a data file. Sam picks a friend’s plain list from the computer.

00:31 Export saves a backup file.

00:35 In this course, you’ll learn how to run code later without freezing the page, and write functions that remember their own variables. How to schedule, repeat, and cancel timers, and count down from a deadline on the page.

00:48 How to split text into fields, and fetch JSON and CSV files from the page’s server. How to read a file the user picks, check it, and save a new file for them to keep.

00:59 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.

01:10 You should know JavaScript basics, and how a page saves its data and redraws a list, like Sam’s box, where this course starts. Each exercise gives you starting code.

01:20 You’ll need a current Chrome or Edge, an editor, and a local server.

01:26 Each of the four sections mixes text lessons and videos, and ends with an exercise in the browser, with automated tests. In the project, you finish Sam’s box, then explain it in a chat with the AI mentor.

01:38 A quiz and a summary close the course. If your code waits for the eggs, what happens to the page? First up: Run Code Later Without Freezing.

Become a Member to join the conversation.