Re: [manifest] Allow developers to detect when the user has added the site to their home screen (or equivalent) (#417)

## Proposal 
Ok, so we really want to deal with 2 cases here: 

 1. the user initiates the install manually. 
 1. the UA initiates the install automatically. 

The Chrome proposal only deals with 2, so I think that is insufficient for us to standardize on. 

## Case 1 -  the user initiates the install manually
This action is non-cancellable, occurs independently of the application (i.e., it is not observable), but the application should still be notified that it was "installed". 

Solution: install event. This simple event fires *after* the UA has installed the application. What "install" means is left up to the UA, but generally means that the icon and application name has been added to the homescreen (or other place where apps are installed, like about:newtab). 

## Case 2 - UA initiated install
(mostly the Chrome case)
 * This action must be programmatically cancellable (user may be doing something important, like driving) and shouldn't be disturbed by an install prompt. So, `.preventDefault()` applies. 
 * It is still important to recover from the point above, so the application must be able to re-`.prompt();`.
 * prompt() vends a promise. The prompt's promise settles with either "installed", "denied", "dismissed".  
 * the "install" event fires when installation is successful. 

What do people think? 

Question: should we deal with install errors or punt on them for now?  

## IDL
```Java
enum InstallationChoice {
  "installed",
  "dismissed",
  "denied",
};

interface BeforeInstallEvent : Event {
 Promise<InstallationChoice> prompt();
};

partial interface WindowEventHandlers {
  attribute EventHandler onbeforeinstall;
  attribute EventHandler oninstall;
};
```

---
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-200192679

Received on Wednesday, 23 March 2016 05:48:46 UTC