From 7a1367d81a9ac743575b6e2fb09d57a5e7148013 Mon Sep 17 00:00:00 2001 From: Evelyn Eastmond Date: Fri, 22 Feb 2019 12:29:24 -0500 Subject: [PATCH] Change from setInterval to setTimeout for auto disconnect feature. --- src/extensions/scratch3_microbit/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/extensions/scratch3_microbit/index.js b/src/extensions/scratch3_microbit/index.js index f18c5e3cf..ce951c717 100644 --- a/src/extensions/scratch3_microbit/index.js +++ b/src/extensions/scratch3_microbit/index.js @@ -299,7 +299,7 @@ class MicroBit { */ _onConnect () { this._ble.read(BLEUUID.service, BLEUUID.rxChar, true, this._onMessage); - this._timeoutID = window.setInterval( + this._timeoutID = window.setTimeout( () => this._ble.handleDisconnectError(BLEDataStoppedError), BLETimeout ); @@ -330,7 +330,7 @@ class MicroBit { // cancel disconnect timeout and start a new one window.clearInterval(this._timeoutID); - this._timeoutID = window.setInterval( + this._timeoutID = window.setTimeout( () => this._ble.handleDisconnectError(BLEDataStoppedError), BLETimeout );