Pass return value through execution-complete message instead of logging
- Return value now passed to window.complete(error, returnValue) - execution-complete message includes returnValue field - SandboxResult interface updated to include returnValue - executionConsumer passes returnValue in resolved promise - Return values properly captured and available to callers
This commit is contained in:
@@ -120,7 +120,7 @@ export class ConsoleRuntimeProvider implements SandboxRuntimeProvider {
|
||||
|
||||
// Expose complete() method for user code to call
|
||||
let completionSent = false;
|
||||
(window as any).complete = async (error?: { message: string; stack: string }) => {
|
||||
(window as any).complete = async (error?: { message: string; stack: string }, returnValue?: any) => {
|
||||
if (completionSent) return;
|
||||
completionSent = true;
|
||||
|
||||
@@ -138,6 +138,7 @@ export class ConsoleRuntimeProvider implements SandboxRuntimeProvider {
|
||||
console.log("Reporting execution complete");
|
||||
await (window as any).sendRuntimeMessage({
|
||||
type: "execution-complete",
|
||||
returnValue,
|
||||
});
|
||||
console.log("Execution completed");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user