File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed
packages/sveltekit-embed/src/lib/components Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change 1111 );
1212
1313 const load_twitter_widgets_script = () => {
14+ if (
15+ document .querySelector (
16+ ' script[src*="platform.twitter.com/widgets.js"]' ,
17+ )
18+ ) {
19+ return ;
20+ }
21+
1422 if (twitter_widgets_script ) return ;
23+
1524 twitter_widgets_script = document .createElement (' script' );
1625 twitter_widgets_script .src =
1726 ' https://platform.twitter.com/widgets.js' ;
2029 };
2130
2231 const remove_twitter_widget_script = () => {
23- if (twitter_widgets_script ) {
24- document .head .removeChild (twitter_widgets_script );
25- twitter_widgets_script = null ;
26- }
32+ if (! twitter_widgets_script ) return ;
33+ document .head .removeChild (twitter_widgets_script );
34+ twitter_widgets_script = null ;
2735 };
2836
29- $effect (() => {
37+ $effect . root (() => {
3038 load_twitter_widgets_script ();
3139 return () => {
3240 remove_twitter_widget_script ();
You can’t perform that action at this time.
0 commit comments