-
Notifications
You must be signed in to change notification settings - Fork 5
Closed
Description
Even with workers, it's apparently not possible to pass JSON directly, see:
Working
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="module" src="https://cdn.jsdelivr.net/npm/polyscript"></script>
<script type="module">
const script = Object.assign(document.createElement("script"), {
type: "pyodide",
textContent: `
print("Hello World")
`,
});
script.toggleAttribute("worker");
script.setAttribute("config", "./config.json");
document.body.appendChild(script);
</script>
</head>
</html>config.json
{
"packages": [
"protobuf"
]
}NOT Working
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="module" src="https://cdn.jsdelivr.net/npm/polyscript"></script>
<script type="module">
const script = Object.assign(document.createElement("script"), {
type: "pyodide",
textContent: `
print("Hello World")
`,
});
script.toggleAttribute("worker");
script.setAttribute("config", JSON.stringify({
packages: ["protobuf"]
}));
document.body.appendChild(script);
</script>
</head>
</html>Metadata
Metadata
Assignees
Labels
No labels