File tree Expand file tree Collapse file tree 1 file changed +13
-13
lines changed
Expand file tree Collapse file tree 1 file changed +13
-13
lines changed Original file line number Diff line number Diff line change 1- let windowObject : Window | undefined ;
2-
3- let cachedWindowObject = false ;
4-
51export function getBrowserWindow ( ) : Window | undefined {
6- if ( cachedWindowObject ) {
7- return windowObject ;
8- }
2+ let windowObject : Window | undefined ;
93
104 try {
115 windowObject ||= globalThis . window ;
6+ if ( windowObject ) {
7+ return windowObject ;
8+ }
129 } catch {
13- // do nothing
10+ // Check next variable
1411 }
1512
1613 try {
1714 windowObject ||= global . window ;
15+ if ( windowObject ) {
16+ return windowObject ;
17+ }
1818 } catch {
19- // do nothing
19+ // Check next variable
2020 }
2121
2222 try {
2323 windowObject ||= window ;
24+ if ( windowObject ) {
25+ return windowObject ;
26+ }
2427 } catch {
25- // do nothing
28+ // return undefined
2629 }
27-
28- cachedWindowObject = true ;
29- return windowObject ;
3030}
3131
3232export function isBrowser ( ) : boolean {
You can’t perform that action at this time.
0 commit comments