Add listener for scan timeout to make scanning state reachable.
This is not yet implemented in the VM, but will be needed when it is.
This commit is contained in:
1 parent
60992f0b94
commit
0c4bdc92a4
1 file changed
+8
@@ -9,6 +9,7 @@ class ScanningStep extends React.Component {
|
||||
super(props);
|
||||
bindAll(this, [
|
||||
'handlePeripheralListUpdate',
|
||||
'handlePeripheralScanTimeout',
|
||||
'handleRefresh'
|
||||
]);
|
||||
this.state = {
|
||||
@@ -20,11 +21,18 @@ class ScanningStep extends React.Component {
|
||||
this.props.vm.startDeviceScan(this.props.extensionId);
|
||||
this.props.vm.on(
|
||||
'PERIPHERAL_LIST_UPDATE', this.handlePeripheralListUpdate);
|
||||
this.props.vm.on(
|
||||
'PERIPHERAL_SCAN_TIMEOUT', this.handlePeripheralScanTimeout);
|
||||
}
|
||||
componentWillUnmount () {
|
||||
// @todo: stop the device scan here
|
||||
this.props.vm.removeListener(
|
||||
'PERIPHERAL_LIST_UPDATE', this.handlePeripheralListUpdate);
|
||||
this.props.vm.removeListener(
|
||||
'PERIPHERAL_SCAN_TIMEOUT', this.handlePeripheralScanTimeout);
|
||||
}
|
||||
handlePeripheralScanTimeout () {
|
||||
this.setState({scanning: false});
|
||||
}
|
||||
handlePeripheralListUpdate (newList) {
|
||||
// TODO: sort peripherals by signal strength? so they don't jump around
|
||||
|
||||
Reference in new issue
Block a user