MCPcopy Create free account
hub / github.com/firebase/quickstart-js / resetUI

Function resetUI

messaging/main.ts:23–44  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

21});
22
23function resetUI() {
24 clearMessages();
25 showToken('loading...');
26 // Get registration token. Initially this makes a network call, once retrieved
27 // subsequent calls to getToken will return from cache.
28 getToken(messaging, { vapidKey }).then((currentToken) => {
29 if (currentToken) {
30 sendTokenToServer(currentToken);
31 updateUIForPushEnabled(currentToken);
32 } else {
33 // Show permission request.
34 console.log('No registration token available. Request permission to generate one.');
35 // Show permission UI.
36 updateUIForPushPermissionRequired();
37 setTokenSentToServer(false);
38 }
39 }).catch((err) => {
40 console.log('An error occurred while retrieving token. ', err);
41 showToken('Error retrieving registration token.');
42 setTokenSentToServer(false);
43 });
44}
45
46
47function showToken(currentToken: string) {

Callers 3

requestPermissionFunction · 0.85
deleteTokenFromFirebaseFunction · 0.85
main.tsFile · 0.85

Calls 6

clearMessagesFunction · 0.85
showTokenFunction · 0.85
sendTokenToServerFunction · 0.85
updateUIForPushEnabledFunction · 0.85
setTokenSentToServerFunction · 0.85

Tested by

no test coverage detected