Created
April 7, 2019 03:29
-
-
Save J-Cake/a9a4e12cfe5487feaa1a3a8cd73cafac to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const that = this; // lol I know | |
const download = <DownloadComp onComplete={() => this.next()} | |
onStatusChange={async function (status) { | |
if (status !== 2 && status !== 3) { | |
console.log('unaffected'); | |
} else { | |
console.log(this); | |
that.setState(prev => ({ | |
inactiveDownloads: [...(prev.inactiveDownloads || []), download] | |
})); | |
console.log(that.state.activeDownloads, that.state.inactiveDownloads); | |
} | |
}} | |
alert={box => this.alert(box)} | |
id={this.state.activeDownloads.length + 1} | |
remove={() => this.setState({ | |
download: [ | |
this.state.activeDownloads.splice(this.state.activeDownloads.indexOf(this), 1) | |
] | |
})} | |
updateTaskBarProgress={(index, progress) => this.updateTaskBarValue(index, progress)} | |
key={Date.now()} url={this.state.downloadURL} | |
customHeaders={this.state.customHeaders} | |
name={this.state.downloadName} | |
ref={ref => this.shouldStart(ref)} | |
/>; | |
await this.setState(prev => ({ | |
activeDownloads: [...prev.activeDownloads, download] | |
})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
what needs to happen