Re: [w3c/manifest] Add installation prompt control flow (#417)

@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