refactor: pass through promise
This commit is contained in:
parent
93cb69e99a
commit
8583772652
|
@ -704,7 +704,10 @@ export default class Sandbox {
|
|||
switch (result.yield) {
|
||||
case YIELD_PROMISE: {
|
||||
stepResult.async = true;
|
||||
stepResult.value = Promise.resolve(result.value)
|
||||
const promise = result.value instanceof Promise
|
||||
? result.value
|
||||
: Promise.resolve(result.value);
|
||||
promise
|
||||
.then((value) => {
|
||||
const top = this.$$execution.stack[this.$$execution.stack.length - 1];
|
||||
this.$$execution.deferred.set(top, {
|
||||
|
@ -712,6 +715,7 @@ export default class Sandbox {
|
|||
yield: YIELD_NONE,
|
||||
});
|
||||
});
|
||||
stepResult.value = promise;
|
||||
break;
|
||||
}
|
||||
case YIELD_LOOP_UPDATE: {
|
||||
|
|
Loading…
Reference in New Issue
Block a user