- From: majaybabu <notifications@github.com>
- Date: Wed, 04 Apr 2018 14:03:56 -0700
- To: w3c/payment-handler <payment-handler@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Wednesday, 4 April 2018 21:04:19 UTC
I tried to postMessage to the popup window as per --> https://w3c.github.io/payment-handler/#post-example. I dont see event listener getting fired on the popup window.
>From sw.js ->
self.addEventListener('paymentrequest', (evt) => {
evt.respondWith(
new Promise((resolve, reject) => {
evt.openWindow("https://majaybabu.github.io/payment-handler-pay/select.html")
.then(function(windowClient) {
console.log('posting msg....');
windowClient.postMessage({msg : "Hey I just got a fetch from you!"});
resolve(JSON.parse("{\"methodName\": \"https://majaybabu.github.io/payment-handler-pay/\", \"details\": \"Hey I just got a fetch from you!\"}"));
});
})
);
});
popup html -
<script>
window.addEventListener('load', function(evt) {
console.log('received:----');
window.addEventListener("message", function (event) {
console.log('message received: ' + event.data.msg);
document.write(event.data.msg);
});
});
</script>
--
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/280#issuecomment-378744508
Received on Wednesday, 4 April 2018 21:04:19 UTC