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) SupportStore.listen(this._onChange)
} }
componentDidUnmount() { componentWillUnmount() {
SupportStore.unlisten(this._onChange) SupportStore.unlisten(this._onChange)
} }

@ -4,7 +4,7 @@ import SupportStore from '../stores/SupportStore'
function getState() { function getState() {
return { 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) SupportStore.listen(this._onChange)
} }
componentDidUnmount() { componentWillUnmount() {
DownloadStore.unlisten(this._onChange) DownloadStore.unlisten(this._onChange)
SupportStore.unlisten(this._onChange) SupportStore.unlisten(this._onChange)
} }

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

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

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

Loading…
Cancel
Save