mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-23 14:32:59 -05:00
Code cleanup -- move out duplicate .then
statements after the next .then
(at the higher level)
This commit is contained in:
parent
94cc7e66b6
commit
13e69bad7b
2 changed files with 3 additions and 6 deletions
|
@ -674,8 +674,6 @@ class Blocks {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO maybe track actual changes,
|
|
||||||
// but for now, emit a project change always
|
|
||||||
this.emitProjectChanged();
|
this.emitProjectChanged();
|
||||||
|
|
||||||
this.resetCache();
|
this.resetCache();
|
||||||
|
|
|
@ -562,15 +562,14 @@ class VirtualMachine extends EventEmitter {
|
||||||
.then(validatedInput => {
|
.then(validatedInput => {
|
||||||
const projectVersion = validatedInput[0].projectVersion;
|
const projectVersion = validatedInput[0].projectVersion;
|
||||||
if (projectVersion === 2) {
|
if (projectVersion === 2) {
|
||||||
return this._addSprite2(validatedInput[0], validatedInput[1])
|
return this._addSprite2(validatedInput[0], validatedInput[1]);
|
||||||
.then(() => this.runtime.emitProjectChanged());
|
|
||||||
}
|
}
|
||||||
if (projectVersion === 3) {
|
if (projectVersion === 3) {
|
||||||
return this._addSprite3(validatedInput[0], validatedInput[1])
|
return this._addSprite3(validatedInput[0], validatedInput[1]);
|
||||||
.then(() => this.runtime.emitProjectChanged());
|
|
||||||
}
|
}
|
||||||
return Promise.reject(`${errorPrefix} Unable to verify sprite version.`);
|
return Promise.reject(`${errorPrefix} Unable to verify sprite version.`);
|
||||||
})
|
})
|
||||||
|
.then(() => this.runtime.emitProjectChanged())
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
// Intentionally rejecting here (want errors to be handled by caller)
|
// Intentionally rejecting here (want errors to be handled by caller)
|
||||||
if (error.hasOwnProperty('validationError')) {
|
if (error.hasOwnProperty('validationError')) {
|
||||||
|
|
Loading…
Reference in a new issue