Skip to content

Commit b270fae

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

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

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)