1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-07-30 18:20:15 +02:00
This commit is contained in:
Kushagra Gour
2018-02-08 03:31:34 +05:30
parent 16acb03593
commit 153f0d8c7a
4 changed files with 24 additions and 2 deletions

13
app/detached-window.js Normal file
View 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;
}
});