This repo contains a utility for sanitising Javascript objects before passing them to postMessage
.
Add to your package.json
by
npm add post_message_filter
Then in your code
import deleteNonClonable from 'post_message_filter/delete_non_clonable';
...
function postMessageWrapper(message, targetOrigin) {
const filteredMessage = deleteNonClonable(message);
postMessage(filteredMessage, targetOrigin);
}
The delete_non_clonable.js
is the build file, the .ts
file the source.
npm run build
IE11, last two versions of Chrome, Edge, and Firefox.