Wrapper for window.postMessage functionality