Skip to content

Commit

Permalink
PR Feedback + typings
Browse files Browse the repository at this point in the history
  • Loading branch information
avolkovi committed Oct 13, 2020
1 parent df41ee3 commit 6193868
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 20 deletions.
34 changes: 18 additions & 16 deletions packages/auth/src/auth.js
Expand Up @@ -321,22 +321,24 @@ fireauth.Auth.prototype.emitEmulatorWarning_ = function() {
fireauth.util.consoleWarn('WARNING: You are using the Auth Emulator,' +
' which is intended for local testing only. Do not use with' +
' production credentials.');
if (goog.global.document && goog.global.document.body) {
const ele = goog.global.document.createElement('p');
ele.innerText = 'Running in emulator mode. Do not use with production' +
' credentials.';
ele.style.position = 'fixed';
ele.style.width = '100%';
ele.style.backgroundColor = '#ffffff';
ele.style.border = '.1em solid #000000';
ele.style.color = '#ff0000';
ele.style.bottom = '0px';
ele.style.left = '0px';
ele.style.margin = '0px';
ele.style.zIndex = 10000;
ele.style.textAlign = 'center';
ele.classList.add('firebase-emulator-warning');
goog.global.document.body.appendChild(ele);
if (goog.global.document) {
fireauth.util.onDomReady().then(() => {
const ele = goog.global.document.createElement('div');
ele.innerText = 'Running in emulator mode. Do not use with production' +
' credentials.';
ele.style.position = 'fixed';
ele.style.width = '100%';
ele.style.backgroundColor = '#ffffff';
ele.style.border = '.1em solid #000000';
ele.style.color = '#ff0000';
ele.style.bottom = '0px';
ele.style.left = '0px';
ele.style.margin = '0px';
ele.style.zIndex = 10000;
ele.style.textAlign = 'center';
ele.classList.add('firebase-emulator-warning');
goog.global.document.body.appendChild(ele);
};
}
}

Expand Down
10 changes: 6 additions & 4 deletions packages/auth/test/auth_test.js
Expand Up @@ -450,10 +450,12 @@ function tearDown() {
currentUserStorageManager = null;
redirectUserStorageManager = null;
if (goog.global.document) {
var el = goog.global.document.querySelector('.firebase-emulator-warning');
if (el) {
el.parentNode.removeChild(el);
}
fireauth.util.onDomReady().then(function () {
var el = goog.global.document.querySelector('.firebase-emulator-warning');
if (el) {
el.parentNode.removeChild(el);
}
};
}
}

Expand Down
8 changes: 8 additions & 0 deletions packages/firebase/index.d.ts
Expand Up @@ -3119,6 +3119,14 @@ declare namespace firebase.auth {
* Sets the current language to the default device/browser preference.
*/
useDeviceLanguage(): void;
/**
* Modify this Auth instance to communicate with the Firebase Auth emulator. This must be
* called synchronously immediately following the first call to `firebase.auth()`. Do not use
* with production credentials as emulator traffic is not encrypted.
*
* @param url - The URL at which the emulator is running (eg, 'http://localhost:9099')
*/
useEmulator(url: string): void;
/**
* Checks a password reset code sent to the user by email or other out-of-band
* mechanism.
Expand Down

0 comments on commit 6193868

Please sign in to comment.