@@ -56,21 +56,17 @@ export default function App() {
5656
5757 return (
5858 < div className= " App" >
59- {isInProgress ? (
60- < p> Download is in progress< / p>
61- ) : (
62- < p> Download is stopped< / p>
63- )}
64- < button onClick= {() => download (fileUrl, " file" )}>
65- Click to download file
59+ < p> Download is in {isInProgress ? ' in progress' : ' stopped' }< / p>
60+ < button onClick= {() => download (fileUrl, " filename" )}>
61+ Click to download the file
6662 < / button>
67- < span> < / span>
68- < button onClick= {() => cancel ()}> Cancel< / button>
63+ < button onClick= {() => cancel ()}> Cancel the download< / button>
6964 < p>
70- Download size {size} bytes and {percentage} %
65+ Download size in bytes {size}
7166 < / p>
72- < LinearProgress variant= " determinate" value= {percentage} / >
73- < p> Elapsed time {elapsed}s< / p>
67+ < label for = " file" > Downloading progress: < / label>
68+ < progress id= " file" value= {percentage} max= " 100" / >
69+ < p> Elapsed time in seconds {elapsed}< / p>
7470 {error && < p> possible error {JSON .stringify (error)}< / p> }
7571 < / div>
7672 );
@@ -85,14 +81,15 @@ export default function App() {
8581
8682- An object with the following keys:
8783
88- 1 . size (size in bytes)
89- 2 . elapsed (in seconds)
90- 3 . percentage (a percentage string)
91- 4 . download (a download function handler)
92- - arguments, both as string: {downloadUrl, filename}
93- 5 . cancel (a cancel function)
94- 6 . error (an error object from the fetch request)
95- 7 . isInProgress (a boolean status wether it is downloading or not)
84+ | key | description | arguments |
85+ | ------------ | -------------------------------- | --------------------------------------- |
86+ | size | size in bytes | n/a |
87+ | elapsed | elapsed time in seconds | n/a |
88+ | percentage | percentage in string | n/a |
89+ | download | download function handler | (downloadUrl: string, filename: string) |
90+ | cancel | cancel function handler | n/a |
91+ | error | error object from the request | n/a |
92+ | isInProgress | boolean denoting download status | n/a |
9693
9794``` jsx
9895const {
0 commit comments