- From: Marcos Cáceres <notifications@github.com>
- Date: Fri, 14 Oct 2016 00:08:48 -0700
- To: w3c/manifest <manifest@noreply.github.com>
- Message-ID: <w3c/manifest/issues/417/253725710@github.com>
Ok, so #506 revealed a couple of issues that we could address. This aim is to minimize impact on existing developer code... but the following would be a breaking change.
I'm wondering, can we make the design work more like this:
```JS
window.onbeforeinstallprompt = async function ( e ) {
if (!userIsDoingThings) {
return; // automatically show it.
}
e.preventDefault();
await Promise.all(thingsTheUserIsDoingThatBlockInstall);
const promptResult = await ev.prompt();
switch (promptResult.userChoice) {
case "dismissed":
// The user didn't want the app 😢
analytics({ userHatesUs: true });
break;
case "accepted":
// Awesome! it's installing
analytics({ userHatesUs: false });
break;
default:
console.error(`Unknown choice? ${promptResult.userChoice}`);
}
}
window.oninstall = e => {
// The application installed!
}
```
Key things that could change:
1. get rid of .userChoice attribute on the event.
1. define a new `interface PromptResult` that contains the user choice and maybe other stuff.
--
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-253725710
Received on Friday, 14 October 2016 07:09:17 UTC