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