Advanced
Stop a Run Half Way
A run has three steps of 120 ms. The server sends a data-step part ({ id, state: "done" }) when each step finishes. When #start is clicked, send Refund ORD-1042.
Show #progress as N of 3 where N is the number of data-step parts received (count them in onData). Add a #stop button that is enabled only while a run is going (status is submitted or streaming) and calls stop(). After a stop, show Stopped after N of 3 steps in #status. After a run that finishes, show Finished.
What Check tests
#stopis disabled before a run- Stopping after the first step says
Stopped after 1 of 3 steps #stopis disabled again after the stop- A run left alone finishes with all 3 steps
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.