mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 15:02:52 -05:00
Update VM to use scratch-parser callback interface
This commit is contained in:
parent
a3ed4cad99
commit
003ed01015
1 changed files with 12 additions and 1 deletions
|
@ -190,7 +190,18 @@ class VirtualMachine extends EventEmitter {
|
|||
// Clear the current runtime
|
||||
this.clear();
|
||||
|
||||
return validate(input)
|
||||
const validationPromise = new Promise((resolve, reject) => {
|
||||
validate(input, (error, res) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
}
|
||||
if (res) {
|
||||
resolve(res);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return validationPromise
|
||||
.then(validatedInput => this.deserializeProject(validatedInput[0], validatedInput[1]))
|
||||
.catch(error => {
|
||||
// Intentionally rejecting here (want errors to be handled by caller)
|
||||
|
|
Loading…
Reference in a new issue