mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-23 14:32:59 -05:00
Change from setInterval to setTimeout for auto disconnect feature.
This commit is contained in:
parent
bb42c0019c
commit
7a1367d81a
1 changed files with 2 additions and 2 deletions
|
@ -299,7 +299,7 @@ class MicroBit {
|
||||||
*/
|
*/
|
||||||
_onConnect () {
|
_onConnect () {
|
||||||
this._ble.read(BLEUUID.service, BLEUUID.rxChar, true, this._onMessage);
|
this._ble.read(BLEUUID.service, BLEUUID.rxChar, true, this._onMessage);
|
||||||
this._timeoutID = window.setInterval(
|
this._timeoutID = window.setTimeout(
|
||||||
() => this._ble.handleDisconnectError(BLEDataStoppedError),
|
() => this._ble.handleDisconnectError(BLEDataStoppedError),
|
||||||
BLETimeout
|
BLETimeout
|
||||||
);
|
);
|
||||||
|
@ -330,7 +330,7 @@ class MicroBit {
|
||||||
|
|
||||||
// cancel disconnect timeout and start a new one
|
// cancel disconnect timeout and start a new one
|
||||||
window.clearInterval(this._timeoutID);
|
window.clearInterval(this._timeoutID);
|
||||||
this._timeoutID = window.setInterval(
|
this._timeoutID = window.setTimeout(
|
||||||
() => this._ble.handleDisconnectError(BLEDataStoppedError),
|
() => this._ble.handleDisconnectError(BLEDataStoppedError),
|
||||||
BLETimeout
|
BLETimeout
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue