electronic-post-message
A postMessage polyfill for electron webview. Useful if you want to reuse existing postMessage libraries to talk with code inside an electron webview (e.g. secret-door).
Usage
Inside of webview
// That's it!! Use postMessage as usualwindowparentwindow
In electron top level window
var proxyIframe = // That's it!! Use postMessage as usual with proxyIframe.contentWindow as targetwindow
FAQ
- Why is
proxyIframe
needed? Because an electronwebview
is not a Window or MessagePort. Which means we can't create an instance ofMessageEvent
with source set towebview
since the browser throws aThe optional 'source' property is neither a Window nor MessagePort.
exception.