download stop button

This commit is contained in:
SpikeHD
2022-05-12 20:32:06 -07:00
parent 8ba3e7022d
commit 3c8a3f2537
8 changed files with 61 additions and 25 deletions

View File

@@ -1,8 +1,9 @@
import React from 'react'
import DownloadHandler from '../../../utils/download'
import './ProgressBar.css'
interface IProps {
downloadManager: any,
downloadManager: DownloadHandler,
}
interface IState {
@@ -18,12 +19,12 @@ export default class ProgressBar extends React.Component<IProps, IState> {
constructor(props: IProps) {
super(props)
const { average, files, total } = this.props.downloadManager.getTotalAverage()
const { average, files, totalSize } = this.props.downloadManager.getTotalAverage()
this.state = {
average,
files,
total
total: totalSize
}
}
@@ -32,7 +33,7 @@ export default class ProgressBar extends React.Component<IProps, IState> {
const intv = setInterval(() => {
const prog = this.props.downloadManager.getTotalAverage()
this.setState({
average: parseInt(prog?.average || 0, 10),
average: prog?.average || 0,
files: prog?.files,
total: prog?.totalSize || 0,
})