Skip to content

Commit 588ab4b

Browse files
committed
Capture window in a variable
1 parent 78bed77 commit 588ab4b

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/core/ApolloClient.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,8 +1169,9 @@ export class ApolloClient {
11691169
*/
11701170
if (!hasSuggestedDevtools && __DEV__) {
11711171
hasSuggestedDevtools = true;
1172+
const win = window;
11721173

1173-
const ua = window.navigator.userAgent;
1174+
const ua = win.navigator.userAgent;
11741175
let url: string | undefined;
11751176

11761177
if (typeof ua === "string") {
@@ -1185,13 +1186,13 @@ export class ApolloClient {
11851186
}
11861187

11871188
if (
1188-
window.document &&
1189-
window.top === window.self &&
1190-
/^(https?|file):$/.test(window.location.protocol) &&
1189+
win.document &&
1190+
win.top === win.self &&
1191+
/^(https?|file):$/.test(win.location.protocol) &&
11911192
url
11921193
) {
11931194
setTimeout(() => {
1194-
if (!(window as any).__APOLLO_DEVTOOLS_GLOBAL_HOOK__) {
1195+
if (!(win as any).__APOLLO_DEVTOOLS_GLOBAL_HOOK__) {
11951196
invariant.log(
11961197
"Download the Apollo DevTools for a better development " +
11971198
"experience: %s",

0 commit comments

Comments
 (0)