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 56
56
let last_console_event: Log ;
57
57
58
58
let iframe = $state .raw <HTMLIFrameElement >();
59
+ let iframe_key = $state (1 );
59
60
let pending_imports = $state (0 );
60
61
let pending = false ;
61
62
105
106
}
106
107
});
107
108
109
+ return () => {
110
+ proxy ?.destroy ();
111
+ };
112
+ });
113
+
114
+ $effect (() => {
115
+ proxy .iframe = iframe ;
108
116
iframe ! .addEventListener (' load' , () => {
109
117
proxy ?.handle_links ();
110
118
ready = true ;
111
119
});
112
-
113
- return () => {
114
- proxy ?.destroy ();
115
- };
116
120
});
117
121
118
122
$effect (() => {
290
294
});
291
295
292
296
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 ;
294
300
};
295
301
296
302
$effect (() => {
355
361
current_log_group = logs = [];
356
362
onLog ?.(logs );
357
363
}
364
+
365
+ function no_blink(_params : object ) {
366
+ return {
367
+ duration: 50 ,
368
+ css : () => ` position: absolute; top: 0; left: 0; `
369
+ };
370
+ }
358
371
</script >
359
372
360
373
{#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 }
377
393
378
394
<div class =" overlay" >
379
395
{#if bundle ?.error }
You can’t perform that action at this time.
0 commit comments