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

marcoscaceres commented on this pull request.



> +        didPrompt: false,
+        userChoice: null,
+        userChoiceResolver: null, // Implicit in spec
+      };
+
+      internal.userChoice = new Promise((resolve) => {
+        if (eventInit && "userChoice" in eventInit) {
+          return resolve(eventInit.userChoice);
+        }
+        internal.userChoiceResolver = resolve;
+      });
+      internalSlots.set(this, internal);
+    }
+
+    prompt() {
+      if (this.isTrusted === false) {

Well, it's as functional as any other user-constructed event that relies on trust. You are correct that it's crippled - but that's again by design: you can still construct these events and fire them, but it's just "prompt()" that doesn't do anything - but that will be exactly the same for the real ones when constructed by developers. In that sense, what is currently implemented is correct per-spec. 

Note that I could, theoretically, take BeforeInstallPromptEvent.js and plug it into Gecko, because we support JS-based IDL bindings. So, in such an implementation I would get a "trusted" event. 

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

Received on Monday, 24 October 2016 12:34:15 UTC