Skip to content

Commit

Permalink
Merge pull request #3117 from Emurgo/yushi/fix-wasm-scope
Browse files Browse the repository at this point in the history
fix WasmScope promised return value
  • Loading branch information
vsubhuman authored Feb 10, 2023
2 parents cdbebe0 + 6e15109 commit 904ced0
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,11 @@ class Module {
* callback promise resolves.
*/
WasmScope<T>(callback: Module => T): T {
return this.__WasmScopeInternal(callback).result;
const scopedResult = this.__WasmScopeInternal(callback);
if (scopedResult instanceof Promise) {
return scopedResult.then(r => r.result);
}
return scopedResult.result;
}

// Need to expose through a getter to get Flow to detect the type correctly
Expand Down

0 comments on commit 904ced0

Please sign in to comment.