Command Palette

Search for a command to run...

Hectal
Phase 12: AI That Runs in the Browser
AI Frontend · Exercise 3 of 5 PreviousNext
Intermediate

Label Text in a Worker, With Cancel

A worker script is already written: it receives text and, after a moment, answers returns or other. Clicking #run should show Working… in #result, send the text from #text to a worker and show the label when it answers.

Clicking #cancel stops the worker and shows Cancelled. After a cancel the late answer must never appear, and clicking #run again must work.

What Check tests

  1. Clicking Run shows Working… first
  2. Then the label returns for a refund question
  3. Another text gives other
  4. Cancel shows Cancelled and the late answer never arrives
  5. Run works again after a cancel

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

Runs in your browser. Your code is saved here.

Your page

Press Run to see the page.

Console

Nothing logged yet.