Skip to content

Commit 25afb34

Browse files
committed
Restore demo code
1 parent 3628f47 commit 25afb34

File tree

2 files changed

+40
-41
lines changed

2 files changed

+40
-41
lines changed

packages/auth/demo/src/index.js

Lines changed: 39 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,7 +1415,6 @@ function getParameterByName(name) {
14151415
* the input field for the confirm email verification process.
14161416
*/
14171417
function populateActionCodes() {
1418-
return;
14191418
let emailForSignIn = null;
14201419
let signInTime = 0;
14211420
if ('localStorage' in window && window['localStorage'] !== null) {
@@ -1732,45 +1731,45 @@ function initApp() {
17321731
}
17331732

17341733
// Install servicerWorker if supported.
1735-
// if ('serviceWorker' in navigator) {
1736-
// navigator.serviceWorker
1737-
// .register('/service-worker.js')
1738-
// .then(reg => {
1739-
// // Registration worked.
1740-
// console.log('Registration succeeded. Scope is ' + reg.scope);
1741-
// })
1742-
// .catch(error => {
1743-
// // Registration failed.
1744-
// console.log('Registration failed with ' + error.message);
1745-
// });
1746-
// }
1747-
1748-
// if (window.Worker) {
1749-
// webWorker = new Worker('/web-worker.js');
1750-
// /**
1751-
// * Handles the incoming message from the web worker.
1752-
// * @param {!Object} e The message event received.
1753-
// */
1754-
// webWorker.onmessage = function (e) {
1755-
// console.log('User data passed through web worker: ', e.data);
1756-
// switch (e.data.type) {
1757-
// case 'GET_USER_INFO':
1758-
// alertSuccess(
1759-
// 'User data passed through web worker: ' + JSON.stringify(e.data)
1760-
// );
1761-
// break;
1762-
// case 'RUN_TESTS':
1763-
// if (e.data.status === 'success') {
1764-
// alertSuccess('Web worker tests ran successfully!');
1765-
// } else {
1766-
// alertError('Error: ' + JSON.stringify(e.data.error));
1767-
// }
1768-
// break;
1769-
// default:
1770-
// return;
1771-
// }
1772-
// };
1773-
// }
1734+
if ('serviceWorker' in navigator) {
1735+
navigator.serviceWorker
1736+
.register('/service-worker.js')
1737+
.then(reg => {
1738+
// Registration worked.
1739+
console.log('Registration succeeded. Scope is ' + reg.scope);
1740+
})
1741+
.catch(error => {
1742+
// Registration failed.
1743+
console.log('Registration failed with ' + error.message);
1744+
});
1745+
}
1746+
1747+
if (window.Worker) {
1748+
webWorker = new Worker('/web-worker.js');
1749+
/**
1750+
* Handles the incoming message from the web worker.
1751+
* @param {!Object} e The message event received.
1752+
*/
1753+
webWorker.onmessage = function (e) {
1754+
console.log('User data passed through web worker: ', e.data);
1755+
switch (e.data.type) {
1756+
case 'GET_USER_INFO':
1757+
alertSuccess(
1758+
'User data passed through web worker: ' + JSON.stringify(e.data)
1759+
);
1760+
break;
1761+
case 'RUN_TESTS':
1762+
if (e.data.status === 'success') {
1763+
alertSuccess('Web worker tests ran successfully!');
1764+
} else {
1765+
alertError('Error: ' + JSON.stringify(e.data.error));
1766+
}
1767+
break;
1768+
default:
1769+
return;
1770+
}
1771+
};
1772+
}
17741773

17751774
/**
17761775
* Asks the web worker, if supported in current browser, to return the user info

packages/auth/test/helpers/erroring_unavailable_persistence.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import { PersistenceInternal, PersistenceType, PersistenceValue } from '../../src/core/persistence';
1919

2020
const PERMISSION_ERROR = typeof window !== 'undefined' ? new DOMException(
21-
'Failed to read this storage class from the Window object; access is denied')
21+
'Failed to read this storage class from the Window; access is denied')
2222
: new Error('This is Node.');
2323

2424
/**

0 commit comments

Comments
 (0)