main
js 19 lines 626 Bytes
Raw
1 // Portal target container.
2 window.container = document.getElementById('container');
3
4 let hasInjectedStyles = false;
5
6 // DevTools styles are injected into the top-level document head (where the main React app is rendered).
7 // This method copies those styles to the child window where each panel (e.g. Elements, Profiler) is portaled.
8 window.injectStyles = getLinkTags => {
9 if (!hasInjectedStyles) {
10 hasInjectedStyles = true;
11
12 const linkTags = getLinkTags();
13
14 // eslint-disable-next-line no-for-of-loops/no-for-of-loops
15 for (const linkTag of linkTags) {
16 document.head.appendChild(linkTag);
17 }
18 }
19 };