- From: Marcos Cáceres <notifications@github.com>
- Date: Wed, 19 Oct 2016 22:36:33 -0700
- To: w3c/manifest <manifest@noreply.github.com>
Received on Thursday, 20 October 2016 05:37:02 UTC
@mgiuca, I think then I need to turn `didPrompt` into a little state machine. The you can call `prompt()` as many times as you like after .preventDefault() - and those calls will silently be ignored:
```
window.addEventListener('beforeinstallprompt', (ev) => {
try {
e.prompt(); // Error: preventDefault not called
} catch (e) {}
e.preventDefault();
e.prompt();
await e.userChoice; // let's say 5 seconds later this resolves...
});
// Second one... runs immediately after the first one
window.addEventListener('beforeinstallprompt', (ev) => {
e.prompt(); // Noop
e.prompt(); // Noop
setTimeout()=>{
e.prompt(); // Throws, because already consumed.
}, 10000); // 10 seconds later
});
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/manifest/issues/417#issuecomment-255013433
Received on Thursday, 20 October 2016 05:37:02 UTC