Skip to content

Commit 9709717

Browse files
committed
pass bundle to iframe, evaluate and render
1 parent e0362b5 commit 9709717

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

public/global.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ main {
343343
margin: 0 auto;
344344
height: 100%;
345345
box-sizing: border-box;
346+
display: flex;
346347
}
347348

348349
section {

src/Output.svelte

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,22 @@
1515
<head>
1616
<script type="module">
1717
18+
let c;
19+
20+
function update(source) {
21+
const blob = new Blob([source], { type: 'text/javascript' });
22+
const url = URL.createObjectURL(blob);
23+
24+
import(url).then(({ default: App }) => {
25+
if (c) c.$destroy();
26+
27+
document.body.innerHTML = '';
28+
c = new App({ target: document.body })
29+
})
30+
}
31+
1832
window.addEventListener('message', event => {
19-
console.log(event.data)
33+
update(event.data)
2034
}, false)
2135
<\/script>
2236
</head>

0 commit comments

Comments
 (0)