iframe-helper
v1.1.3
Published
iframe communication
Downloads
6
Readme
iframe communication helper
host
// Host
import { Host as IframeHost } from 'iframe-helper';
const host = new IframeHost(iframeElement, iframeUrl);
host.addHandler('methodName', async (methodData) => {
return 'xxx';
});
// call this before load iframe
host.init();
iframe
import { Subpage } from 'iframe-helper';
const helper = new Subpage();
helper.ready.then(() => helper.call('methodName', methodData))
.then((result) => console.log('result', result))
.catch(e => console.error(e))