Adapt wasm-pack new response

This commit is contained in:
titaneric 2021-04-15 01:57:03 +08:00
parent f49d0cc17e
commit bb7e8657cb
1 changed files with 5 additions and 3 deletions

View File

@ -181,9 +181,9 @@ function playground_text(playground) {
body: JSON.stringify(params)
})
.then(response => response.json())
.then(({ wasm_js, wasm_bg, error }) => {
if (error) {
throw new Error(error);
.then(({ wasm_js, wasm_bg, success, stderr }) => {
if (!success) {
throw new Error(stderr);
}
return {
@ -238,11 +238,13 @@ function playground_text(playground) {
function createIFrame(src) {
var iframe = document.createElement('iframe');
iframe.scrolling = 'no';
iframe.style.height = "100%";
iframe.style.width = "100%";
iframe.style.padding = 0;
iframe.style.margin = 0;
iframe.style.border = 0;
iframe.style.overflow = "hidden";
iframe.src = createObjectURL(src, "text/html");
return iframe
}