dollarshaveclub / postmate

📭 A powerful, simple, promise-based postMessage library.
MIT License
1.86k stars 184 forks source link

When reload the iframe 'handshake' and 'call' message conflict #242

Open Nicooyeah opened 1 year ago

Nicooyeah commented 1 year ago

What Is the issue?

After new a postmate, I re-set the 'src' for iframe and call 'call' to send message to child. But the event listener monitor the 'load' event, so it trigger the 'loaded' and try to send handshake. By the time, in child page, due to the reload, it re-call the new Postmate.Model, and run sendHandshakeReply, but the data.postmate it received is not 'handshake' but 'call', so the hand shake reply fail.

Provide issue context below using code examples, images, or links

image

Read about references issues here. Provide paragraph text responses to each header.