From 13e69bad7b02ce96605fba97f73a6f14bcb14ae7 Mon Sep 17 00:00:00 2001 From: Karishma Chadha Date: Wed, 30 Jan 2019 16:45:38 -0500 Subject: [PATCH] Code cleanup -- move out duplicate `.then` statements after the next `.then` (at the higher level) --- src/engine/blocks.js | 2 -- src/virtual-machine.js | 7 +++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/engine/blocks.js b/src/engine/blocks.js index 9f6d8b99b..05de4e7e6 100644 --- a/src/engine/blocks.js +++ b/src/engine/blocks.js @@ -674,8 +674,6 @@ class Blocks { } } - // TODO maybe track actual changes, - // but for now, emit a project change always this.emitProjectChanged(); this.resetCache(); diff --git a/src/virtual-machine.js b/src/virtual-machine.js index 0db45536b..68f888257 100644 --- a/src/virtual-machine.js +++ b/src/virtual-machine.js @@ -562,15 +562,14 @@ class VirtualMachine extends EventEmitter { .then(validatedInput => { const projectVersion = validatedInput[0].projectVersion; if (projectVersion === 2) { - return this._addSprite2(validatedInput[0], validatedInput[1]) - .then(() => this.runtime.emitProjectChanged()); + return this._addSprite2(validatedInput[0], validatedInput[1]); } if (projectVersion === 3) { - return this._addSprite3(validatedInput[0], validatedInput[1]) - .then(() => this.runtime.emitProjectChanged()); + return this._addSprite3(validatedInput[0], validatedInput[1]); } return Promise.reject(`${errorPrefix} Unable to verify sprite version.`); }) + .then(() => this.runtime.emitProjectChanged()) .catch(error => { // Intentionally rejecting here (want errors to be handled by caller) if (error.hasOwnProperty('validationError')) {