Skip to content

Commit

Permalink
Update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
JodusNodus committed May 3, 2017
1 parent 5de2572 commit a43fb37
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
10 changes: 5 additions & 5 deletions examples/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ class Example extends Component {
constructor(props){
super(props)
this.state = {
delay: 100,
delay: 500,
result: 'No result',
}

this.handleScan = this.handleScan.bind(this)
}
handleScan(data){
this.setState({
result: data,
})
handleScan(result){
if(result){
this.setState({ result })
}
}
handleError(err){
console.error(err)
Expand Down
11 changes: 6 additions & 5 deletions examples/legacy-mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ class LegacyModeExample extends Component {
}

this.handleScan = this.handleScan.bind(this)
this.openImageDialog = this.openImageDialog.bind(this)
}
handleScan(data){
this.setState({
result: data,
})
handleScan(result){
if(result){
this.setState({ result })
}
}
handleError(err){
console.error(err)
Expand All @@ -39,7 +40,7 @@ class LegacyModeExample extends Component {
onScan={this.handleScan}
legacyMode
/>
<input type="button" value="Submit QR Code" onClick={this.openImageDialog.bind(this)} />
<input type="button" value="Submit QR Code" onClick={this.openImageDialog} />
<p>{this.state.result}</p>
</div>
)
Expand Down

0 comments on commit a43fb37

Please sign in to comment.