- From: Dave Longley <notifications@github.com>
- Date: Thu, 31 May 2018 07:17:58 -0700
- To: w3c/payment-handler <payment-handler@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Thursday, 31 May 2018 14:18:22 UTC
Example: ```js let paymentResult; self.addEventListener('message', e => { if (!e.data) return; if (e.data.action === 'init') { e.source.postMessage({ ... }); } else if (e.data.action === 'response') { paymentResult = e.data.responseData; } }); self.addEventListener('paymentrequest', e => { e.waitUntil(async () => { const windowClient = await e.openWindow("..."); // The following code should wait until the window is closed await windowClient.waitUntilClosed(); // If paymentResult is undefined, payment request will be aborted in merchant side. // If paymentResult has correct data, payment request will be succeeded. await e.respondWith(paymentResult); }); }); ``` Something more complicated could be cooked up if a `close` event could be listened for. -- 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-handler/issues/300#issuecomment-393545271
Received on Thursday, 31 May 2018 14:18:22 UTC