Re: [w3c/payment-request] Dont block UI if .updateWith() not called (closes #589) (#591)

marcoscaceres commented on this pull request.



> +              need to call <a>updateWith()</a> and provide a
+              <a>PaymentDetailsUpdate</a> dictionary, or a promise for one,
+              containing changed values that the <a>user agent</a> presents to
+              the user.
+            </p>
+            <p>
+              To prevent the user interface from blocking (and to reflect
+              changes made by the end-user through the UI), developers need to
+              immediately call <a>updateWith()</a>. If they don't,
+              <a>[[\didUpdate]]</a> becomes true and <a>updateWith()</a>
+              will throw.
+            </p>
+            <pre class="example" title="how to use `updateWith()` correctly.">
+              // ❌ Bad - this won't work!
+              request.onshippingaddresschange = async ev =&gt; {
+                // `await` goes to next tick, so [[didUpdate]] is now true.

I know... "didUpdate" is not a great name... I wanted something that denoted "consumed" or "expired" or "this can't be used again". I'm open to suggestions. 

-- 
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/591#discussion_r135436699

Received on Monday, 28 August 2017 03:36:54 UTC