Skip to content

Utility to sanitise Javascript objects before passing them to postMessage

License

Notifications You must be signed in to change notification settings

zendesk/post_message_filter

Repository files navigation

postMessage filter

This repo contains a utility for sanitising Javascript objects before passing them to postMessage.

Getting Started

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);
}

Building

The delete_non_clonable.js is the build file, the .ts file the source.

npm run build

Browser Support

IE11, last two versions of Chrome, Edge, and Firefox.

About

Utility to sanitise Javascript objects before passing them to postMessage

Resources

License

Stars

Watchers

Forks

Packages

No packages published