Re: [w3c/manifest] WIP: beforeinstallprompt (#506)

kenchris commented on this pull request.



> +      <p>... the foo app ...</p>
+      <button id="cancel">CANCEL</button>
+      <button id="add">ADD</button>
+    `;
+    const cancel = prompt.querySelector("#cancel");
+    const add = prompt.querySelector("#add");
+    document.body.appendChild(prompt);
+    const p = new Promise((resolve) => {
+      add.addEventListener("click", () => {
+        resolve("accepted");
+        //emulate installation to home screen
+        setTimeout(() => {
+          window.dispatchEvent(new Event("appinstalled"));
+        }, 1000);
+      });
+      cancel.addEventListener("click", () => resolve("dismissed"));

if it has default arguments and you don't care abut them, then I prefer _ over ()

-- 
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/pull/506#pullrequestreview-5429345

Received on Monday, 24 October 2016 11:28:58 UTC