File tree Expand file tree Collapse file tree 2 files changed +8
-16
lines changed
Expand file tree Collapse file tree 2 files changed +8
-16
lines changed Original file line number Diff line number Diff line change 2828 import { mountEmbed } from '/src/lib/utils/mountEmbed' ;
2929 import Embed from '/src/components/datawrapper-switcher/embed.svelte' ;
3030
31- function mount ( ) {
32- console . log ( 'mounting datawrapper switcher embed' ) ;
33- mountEmbed ( 'datawrapper-switcher' , Embed ) ;
34- }
35-
36- window . addEventListener ( 'popstate' , ( ) => {
37- console . log ( 'popstate, remounting datawrapper switcher embed' ) ;
38- mount ( ) ;
39- } ) ;
40-
41- if ( document . readyState === 'loading' ) {
42- document . addEventListener ( 'DOMContentLoaded' , mount ) ;
43- } else {
44- mount ( ) ;
45- }
31+ window . __mountDatawrapperSwitcher = ( ) => mountEmbed ( 'datawrapper-switcher' , Embed ) ;
32+ </ script >
33+ < script >
34+ window . __mountDatawrapperSwitcher && window . __mountDatawrapperSwitcher ( ) ;
4635 </ script >
4736 </ body >
4837</ html >
Original file line number Diff line number Diff line change 2828 import { mountEmbed } from '/src/lib/utils/mountEmbed' ;
2929 import Embed from '/src/components/highlight-cards/embed.svelte' ;
3030
31- mountEmbed ( 'highlight-cards' , Embed ) ;
31+ window . __mountHighlightCards = ( ) => mountEmbed ( 'highlight-cards' , Embed ) ;
32+ </ script >
33+ < script >
34+ window . __mountHighlightCards && window . __mountHighlightCards ( ) ;
3235 </ script >
3336 </ body >
3437</ html >
You can’t perform that action at this time.
0 commit comments