mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-23 06:23:37 -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.resetCache();
|
||||
|
|
|
@ -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')) {
|
||||
|
|
Loading…
Reference in a new issue