File tree Expand file tree Collapse file tree 1 file changed +37
-21
lines changed
packages/repl/src/lib/Output Expand file tree Collapse file tree 1 file changed +37
-21
lines changed Original file line number Diff line number Diff line change 5656 let last_console_event: Log ;
5757
5858 let iframe = $state .raw <HTMLIFrameElement >();
59+ let iframe_key = $state (1 );
5960 let pending_imports = $state (0 );
6061 let pending = false ;
6162
105106 }
106107 });
107108
109+ return () => {
110+ proxy ?.destroy ();
111+ };
112+ });
113+
114+ $effect (() => {
115+ proxy .iframe = iframe ;
108116 iframe ! .addEventListener (' load' , () => {
109117 proxy ?.handle_links ();
110118 ready = true ;
111119 });
112-
113- return () => {
114- proxy ?.destroy ();
115- };
116120 });
117121
118122 $effect (() => {
290294 });
291295
292296 export const reset = () => {
293- if (ready ) apply_bundle (bundle );
297+ if (! ready || ! bundle || bundle .error || error || status ) return ;
298+ ready = false ;
299+ iframe_key += 1 ;
294300 };
295301
296302 $effect (() => {
355361 current_log_group = logs = [];
356362 onLog ?.(logs );
357363 }
364+
365+ function no_blink(_params : object ) {
366+ return {
367+ duration: 50 ,
368+ css : () => ` position: absolute; top: 0; left: 0; `
369+ };
370+ }
358371 </script >
359372
360373{#snippet main ()}
361- <iframe
362- title =" Result"
363- class:inited
364- bind:this ={iframe }
365- sandbox ={[
366- ' allow-scripts' ,
367- ' allow-popups' ,
368- ' allow-forms' ,
369- ' allow-pointer-lock' ,
370- ' allow-modals' ,
371- can_escape ? ' allow-popups-to-escape-sandbox' : ' ' ,
372- relaxed ? ' allow-same-origin' : ' '
373- ].join (' ' )}
374- class ={error || pending || pending_imports ? ' greyed-out' : ' ' }
375- srcdoc ={BROWSER ? srcdoc : ' ' }
376- ></iframe >
374+ {#key iframe_key }
375+ <iframe
376+ title =" Result"
377+ class:inited
378+ bind:this ={iframe }
379+ sandbox ={[
380+ ' allow-scripts' ,
381+ ' allow-popups' ,
382+ ' allow-forms' ,
383+ ' allow-pointer-lock' ,
384+ ' allow-modals' ,
385+ can_escape ? ' allow-popups-to-escape-sandbox' : ' ' ,
386+ relaxed ? ' allow-same-origin' : ' '
387+ ].join (' ' )}
388+ class ={error || pending || pending_imports ? ' greyed-out' : ' ' }
389+ srcdoc ={BROWSER ? srcdoc : ' ' }
390+ out:no _blink
391+ ></iframe >
392+ {/ key }
377393
378394 <div class =" overlay" >
379395 {#if bundle ?.error }
You can’t perform that action at this time.
0 commit comments