Re: [w3c/payment-request] add paymentmethodchange event (#695)

domenic requested changes on this pull request.

Confused how the payment method change steps are supposed to be implemented...

> @@ -3476,6 +3606,49 @@ <h2>
           </li>
         </ol>
       </section>
+      <section>
+        <h2>
+          Payment method changed algorithm
+        </h2>
+        <p>
+          The user agent MUST run the <dfn>payment method changed
+          algorithm</dfn> runs when the user changes <a>payment method</a>. The

extra word "runs"

> @@ -3476,6 +3606,49 @@ <h2>
           </li>
         </ol>
       </section>
+      <section>
+        <h2>
+          Payment method changed algorithm
+        </h2>
+        <p>
+          The user agent MUST run the <dfn>payment method changed
+          algorithm</dfn> runs when the user changes <a>payment method</a>. The
+          algorithm takes <var>methodDetails</var>, which is either
+          <a data-cite="!WEBIDL#idl-dictionary">dictionary</a> or an
+          <a data-cite="!WEBIDL#idl-object">object</a> or null, and a
+          <var>methodName</var>, which is a DOMString that represents the
+          <a>payment method identifier</a> of the <a>payment handler</a> the
+          user is interacting with:

How does the user agent determine _methodName_ and _methodDetails_?

> +          </li>
+          <li>
+            <a>Queue a task</a> on the <a>user interaction task source</a> to
+            run the following steps:
+            <ol>
+              <li>If the <var>request</var>.<a>[[\updating]]</a> is true, then
+              terminate this algorithm and take no further action. Only one
+              update may take place at a time. The <a>user agent</a> SHOULD
+              ensure that this never occurs.
+              </li>
+              <li>If the <var>request</var>.<a>[[\state]]</a> is not set to
+              "<a>interactive</a>", then terminate this algorithm and take no
+              further action. The <a>user agent</a> user interface SHOULD
+              ensure that this never occurs.
+              </li>
+              <li data-link-for="PaymentMethodChangeEvent">Fire an event

Ideally "fire an event" should be linked

>          </table>
       </section>
+      <section data-dfn-for="PaymentMethodChangeEvent" data-link-for=
+      "PaymentMethodChangeEvent">
+        <h2>
+          <dfn>PaymentMethodChangeEvent</dfn> interface
+        </h2>
+        <pre class="idl">
+          [Constructor(DOMString type, optional PaymentMethodChangeEventInit eventInitDict), SecureContext, Exposed=Window]
+          interface PaymentMethodChangeEvent : PaymentRequestUpdateEvent {
+            readonly attribute DOMString methodName;
+            readonly attribute object? methodDetails;
+          };
+        </pre>
+        <section>
+          <h2>

Soooo I know it goes against all previous advice and good sense, but currently for events we don't use internal slots :(. Instead we use the old-style, terrible, "When getting, returns the value it was initialized with". I think making this less terrible is mostly tracked by https://github.com/whatwg/dom/issues/364, /cc @annevk. But in the end we do want to end up in a world that doesn't require people to explicitly define slots and return them for every event property, so I would take the slots out for now. Especially since nothing in this spec sets them.

-- 
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/payment-request/pull/695#pullrequestreview-126178465

Received on Tuesday, 5 June 2018 22:40:48 UTC