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
- Clicking Run shows
Working…first - Then the label
returnsfor a refund question - Another text gives
other - Cancel shows
Cancelledand the late answer never arrives - 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.