Skip to content

Commit

Permalink
added try..catch to interop.js
Browse files Browse the repository at this point in the history
  • Loading branch information
LZ-Jason-Marckel committed Feb 25, 2024
1 parent 2a48acf commit fabaec0
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions Client/wwwroot/script/interop.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,18 @@ export async function isInstalled() {
}

export async function installPWA() {
// Show the install prompt
deferredPrompt.prompt();
// Wait for the user to respond to the prompt
const { outcome } = await deferredPrompt.userChoice;
// Optionally, send analytics event with outcome of user choice
console.log(`User response to the install prompt: ${outcome}`);
// We've used the prompt, and can't use it again, throw it away
deferredPrompt = null;
try {
// Show the install prompt
deferredPrompt.prompt();
// Wait for the user to respond to the prompt
const { outcome } = await deferredPrompt.userChoice;
// Optionally, send analytics event with outcome of user choice
console.log(`User response to the install prompt: ${outcome}`);
// We've used the prompt, and can't use it again, throw it away
deferredPrompt = null;
} catch (e) {
deferredPrompt = null;
}
}

export async function showModal(id) {
Expand Down

0 comments on commit fabaec0

Please sign in to comment.