File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
src/routes/tutorial/[slug] Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 74
74
function set_iframe_src (src ) {
75
75
if (! iframe) return ; // HMR
76
76
77
+ // To prevent iframe flickering.
78
+ // Set to `visible` by calling `set_iframe_visible` function
79
+ // from iframe on:load or setTimeout
80
+ iframe .style .visibility = ' hidden' ;
81
+ setTimeout (set_iframe_visible, 1000 );
82
+
77
83
// removing the iframe from the document allows us to
78
84
// change the src without adding a history entry, which
79
85
// would make back/forward traversal very annoying
82
88
iframe .src = src;
83
89
parentNode? .appendChild (iframe);
84
90
}
91
+
92
+ function set_iframe_visible () {
93
+ if (iframe .style .visibility === ' hidden' ) {
94
+ iframe .style .visibility = ' visible' ;
95
+ }
96
+ }
85
97
< / script>
86
98
87
99
< svelte: window on: message= {handle_message} / >
105
117
106
118
< div class = " content" >
107
119
{#if browser}
108
- < iframe bind: this = {iframe} title= " Output" / >
120
+ < iframe bind: this = {iframe} title= " Output" on : load = {set_iframe_visible} / >
109
121
{/ if }
110
122
111
123
{#if paused || loading || $error}
You can’t perform that action at this time.
0 commit comments