Rename componentDidUnmount to componentWillUnmount

pull/54/head
tomsapps 9 years ago
parent 042df20da7
commit 0bf4be74c7

@ -24,7 +24,7 @@ export default class App extends React.Component {
SupportStore.listen(this._onChange)
}
componentDidUnmount() {
componentWillUnmount() {
SupportStore.unlisten(this._onChange)
}

@ -4,7 +4,7 @@ import SupportStore from '../stores/SupportStore'
function getState() {
return {
active: SupportStore.getState().isChrome && DownloadStore.getState().fileSize >= 500000000
active: SupportStore.getState().isChrome && DownloadStore.getState().fileSize >= 500000000
}
}
@ -24,7 +24,7 @@ export default class ChromeNotice extends React.Component {
SupportStore.listen(this._onChange)
}
componentDidUnmount() {
componentWillUnmount() {
DownloadStore.unlisten(this._onChange)
SupportStore.unlisten(this._onChange)
}

@ -23,7 +23,7 @@ export default class DownloadPage extends React.Component {
DownloadStore.listen(this._onChange)
}
componentDidUnmount() {
componentWillUnmount() {
DownloadStore.unlisten(this._onChange)
}

@ -17,7 +17,7 @@ export default class ErrorPage extends React.Component {
ErrorStore.listen(this._onChange)
}
componentDidUnmount() {
componentWillUnmount() {
ErrorStore.unlisten(this._onChange)
}

@ -12,40 +12,40 @@ export default class UploadPage extends React.Component {
constructor() {
super()
this.state = UploadStore.getState()
this._onChange = () => {
this.setState(UploadStore.getState())
}
}
componentDidMount() {
UploadStore.listen(this._onChange)
}
componentDidUnmount() {
componentWillUnmount() {
UploadStore.unlisten(this._onChange)
}
uploadFile(file) {
UploadActions.uploadFile(file)
}
handleSelectedFile(event) {
let files = event.target.files
if (files.length > 0) {
UploadActions.uploadFile(files[0])
}
}
render() {
switch (this.state.status) {
case 'ready':
return <DropZone onDrop={this.uploadFile.bind(this)}>
<div className="page">
<Spinner dir="up" />
<h1>FilePizza</h1>
<p>Free peer-to-peer file transfers in your browser.</p>
<p>We never store anything. Files only served fresh.</p>
@ -57,30 +57,30 @@ export default class UploadPage extends React.Component {
</p>
</div>
</DropZone>
case 'processing':
return <div className="page">
<Spinner dir="up" animated />
<h1>FilePizza</h1>
<p>Processing...</p>
</div>
case 'uploading':
return <div className="page">
<h1>FilePizza</h1>
<Spinner dir="up" animated
name={this.state.fileName}
size={this.state.fileSize} />
<p>Send someone this link to download.</p>
<p>This link will work as long as this page is open.</p>
<p>Peers: {this.state.peers} &middot; Up: {formatSize(this.state.speedUp)}</p>
<Tempalink token={this.state.token} />
</div>
}
}

Loading…
Cancel
Save