Skip to content

Commit 3f56454

Browse files
committed
PR Feedback + typings
1 parent df41ee3 commit 3f56454

File tree

3 files changed

+32
-20
lines changed

3 files changed

+32
-20
lines changed

packages/auth/src/auth.js

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -321,22 +321,24 @@ fireauth.Auth.prototype.emitEmulatorWarning_ = function() {
321321
fireauth.util.consoleWarn('WARNING: You are using the Auth Emulator,' +
322322
' which is intended for local testing only. Do not use with' +
323323
' production credentials.');
324-
if (goog.global.document && goog.global.document.body) {
325-
const ele = goog.global.document.createElement('p');
326-
ele.innerText = 'Running in emulator mode. Do not use with production' +
327-
' credentials.';
328-
ele.style.position = 'fixed';
329-
ele.style.width = '100%';
330-
ele.style.backgroundColor = '#ffffff';
331-
ele.style.border = '.1em solid #000000';
332-
ele.style.color = '#ff0000';
333-
ele.style.bottom = '0px';
334-
ele.style.left = '0px';
335-
ele.style.margin = '0px';
336-
ele.style.zIndex = 10000;
337-
ele.style.textAlign = 'center';
338-
ele.classList.add('firebase-emulator-warning');
339-
goog.global.document.body.appendChild(ele);
324+
if (goog.global.document) {
325+
fireauth.util.onDomReady().then(() => {
326+
const ele = goog.global.document.createElement('div');
327+
ele.innerText = 'Running in emulator mode. Do not use with production' +
328+
' credentials.';
329+
ele.style.position = 'fixed';
330+
ele.style.width = '100%';
331+
ele.style.backgroundColor = '#ffffff';
332+
ele.style.border = '.1em solid #000000';
333+
ele.style.color = '#ff0000';
334+
ele.style.bottom = '0px';
335+
ele.style.left = '0px';
336+
ele.style.margin = '0px';
337+
ele.style.zIndex = 10000;
338+
ele.style.textAlign = 'center';
339+
ele.classList.add('firebase-emulator-warning');
340+
goog.global.document.body.appendChild(ele);
341+
});
340342
}
341343
}
342344

packages/auth/test/auth_test.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -450,10 +450,12 @@ function tearDown() {
450450
currentUserStorageManager = null;
451451
redirectUserStorageManager = null;
452452
if (goog.global.document) {
453-
var el = goog.global.document.querySelector('.firebase-emulator-warning');
454-
if (el) {
455-
el.parentNode.removeChild(el);
456-
}
453+
fireauth.util.onDomReady().then(function () {
454+
var el = goog.global.document.querySelector('.firebase-emulator-warning');
455+
if (el) {
456+
el.parentNode.removeChild(el);
457+
}
458+
});
457459
}
458460
}
459461

packages/firebase/index.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3119,6 +3119,14 @@ declare namespace firebase.auth {
31193119
* Sets the current language to the default device/browser preference.
31203120
*/
31213121
useDeviceLanguage(): void;
3122+
/**
3123+
* Modify this Auth instance to communicate with the Firebase Auth emulator. This must be
3124+
* called synchronously immediately following the first call to `firebase.auth()`. Do not use
3125+
* with production credentials as emulator traffic is not encrypted.
3126+
*
3127+
* @param url - The URL at which the emulator is running (eg, 'http://localhost:9099')
3128+
*/
3129+
useEmulator(url: string): void;
31223130
/**
31233131
* Checks a password reset code sent to the user by email or other out-of-band
31243132
* mechanism.

0 commit comments

Comments
 (0)