Skip to content

Commit 13e69ba

Browse files
committed
Code cleanup -- move out duplicate .then statements after the next .then (at the higher level)
1 parent 94cc7e6 commit 13e69ba

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

src/engine/blocks.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -674,8 +674,6 @@ class Blocks {
674674
}
675675
}
676676

677-
// TODO maybe track actual changes,
678-
// but for now, emit a project change always
679677
this.emitProjectChanged();
680678

681679
this.resetCache();

src/virtual-machine.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -562,15 +562,14 @@ class VirtualMachine extends EventEmitter {
562562
.then(validatedInput => {
563563
const projectVersion = validatedInput[0].projectVersion;
564564
if (projectVersion === 2) {
565-
return this._addSprite2(validatedInput[0], validatedInput[1])
566-
.then(() => this.runtime.emitProjectChanged());
565+
return this._addSprite2(validatedInput[0], validatedInput[1]);
567566
}
568567
if (projectVersion === 3) {
569-
return this._addSprite3(validatedInput[0], validatedInput[1])
570-
.then(() => this.runtime.emitProjectChanged());
568+
return this._addSprite3(validatedInput[0], validatedInput[1]);
571569
}
572570
return Promise.reject(`${errorPrefix} Unable to verify sprite version.`);
573571
})
572+
.then(() => this.runtime.emitProjectChanged())
574573
.catch(error => {
575574
// Intentionally rejecting here (want errors to be handled by caller)
576575
if (error.hasOwnProperty('validationError')) {

0 commit comments

Comments
 (0)