Skip to content

Commit b0e7566

Browse files
committed
Addressed comments
1 parent 25f3a21 commit b0e7566

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

packages/util/src/emulator.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,6 @@ interface EmulatorStatuses {
146146
}
147147
const emulatorStatus: EmulatorStatuses = {};
148148

149-
export interface EmulatorStatus {
150-
isRunningEmulator: boolean;
151-
}
152-
153149
// Checks whether any products are running on an emulator
154150
function areRunningEmulator(): boolean {
155151
let runningEmulator = false;
@@ -182,10 +178,14 @@ export function updateEmulatorBanner(
182178
name: string,
183179
isRunningEmulator: boolean
184180
): void {
185-
if (emulatorStatus[name] === isRunningEmulator) {
186-
// No rerendering required
181+
if (
182+
typeof window === 'undefined' ||
183+
typeof document === 'undefined' ||
184+
emulatorStatus[name] === isRunningEmulator
185+
) {
187186
return;
188187
}
188+
189189
emulatorStatus[name] = isRunningEmulator;
190190
const bannerId = '__firebase__banner';
191191
if (!areRunningEmulator()) {
@@ -232,11 +232,9 @@ export function updateEmulatorBanner(
232232
firebaseText.setAttribute('id', '__firebase__text');
233233
firebaseText.innerText = 'Running in this workspace';
234234
}
235-
if (typeof window !== 'undefined' && typeof document !== 'undefined') {
236-
if (document.readyState === 'loading') {
237-
window.addEventListener('DOMContentLoaded', setupDom);
238-
} else {
239-
setupDom();
240-
}
235+
if (document.readyState === 'loading') {
236+
window.addEventListener('DOMContentLoaded', setupDom);
237+
} else {
238+
setupDom();
241239
}
242240
}

0 commit comments

Comments
 (0)