mirror of
https://github.com/chinchang/web-maker.git
synced 2025-04-16 16:51:53 +02:00
build
This commit is contained in:
parent
16acb03593
commit
153f0d8c7a
13
app/detached-window.js
Normal file
13
app/detached-window.js
Normal file
@ -0,0 +1,13 @@
|
||||
window.addEventListener('message', e => {
|
||||
if (e.data && e.data.contents) {
|
||||
const frame = document.querySelector('iframe');
|
||||
frame.src = frame.src;
|
||||
setTimeout(() => {
|
||||
frame.contentDocument.open();
|
||||
frame.contentDocument.write(e.data.contents);
|
||||
frame.contentDocument.close();
|
||||
}, 10);
|
||||
} else {
|
||||
document.querySelector('iframe').src = e.data;
|
||||
}
|
||||
});
|
9
app/preview.html
Normal file
9
app/preview.html
Normal file
@ -0,0 +1,9 @@
|
||||
<link rel="stylesheet" href="style.css">
|
||||
|
||||
<body>
|
||||
|
||||
<iframe src="about://blank" frameborder="0" id="demo-frame" allowfullscreen></iframe>
|
||||
|
||||
|
||||
<script src="detached-window.js"></script>
|
||||
</body>
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user