update frontend
This commit is contained in:
parent
80d75a7a57
commit
5b3d35cd25
|
|
@ -1,24 +1,20 @@
|
|||
// src/pwaInstall.js
|
||||
let deferredPrompt = null;
|
||||
|
||||
// Stocke l'événement natif quand Chrome le déclenche
|
||||
window.addEventListener('beforeinstallprompt', (e) => {
|
||||
e.preventDefault();
|
||||
deferredPrompt = e;
|
||||
console.log('PWA: Install prompt ready - button can trigger it');
|
||||
console.log('PWA prompt ready');
|
||||
});
|
||||
|
||||
// Fonction appelée par le bouton "Install"
|
||||
export function promptInstall() {
|
||||
if (deferredPrompt) {
|
||||
console.log('PWA: Triggering native install prompt');
|
||||
deferredPrompt.prompt();
|
||||
deferredPrompt.userChoice.then((choice) => {
|
||||
console.log('PWA Install outcome:', choice.outcome);
|
||||
deferredPrompt = null;
|
||||
console.log('Install outcome:', choice.outcome);
|
||||
});
|
||||
deferredPrompt = null;
|
||||
} else {
|
||||
console.log('PWA: No prompt ready yet - scroll/click more');
|
||||
alert('PWA not ready yet. Try scrolling the map, clicking filters or markers, then click Install again.');
|
||||
alert('Prompt not ready. Scroll the map, click a filter, then try again.');
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue