Simplified the return value for when power is 0 in motorOnForRotation()

This commit is contained in:
Kevin Andersen 2019-04-12 14:07:26 -04:00
parent a98f3af2e1
commit 12e969119a

View file

@ -1696,7 +1696,7 @@ class Scratch3BoostBlocks {
const motor = this._peripheral.motor(portID); const motor = this._peripheral.motor(portID);
if (motor) { if (motor) {
// to avoid a hanging block if power is 0, return an immediately resolving promise. // to avoid a hanging block if power is 0, return an immediately resolving promise.
if (motor.power === 0) return new Promise(resolve => resolve()); if (motor.power === 0) return Promise.resolve();
return new Promise(resolve => { return new Promise(resolve => {
motor.turnOnForDegrees(degrees, sign); motor.turnOnForDegrees(degrees, sign);
motor.pendingPromiseFunction = resolve; motor.pendingPromiseFunction = resolve;