Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import 'url-polyfill';
import { Client } from 'iframe-coordinator/dist/client';
document.getElementById('path').innerHTML = window.location.hash;
window.onhashchange = function() {
document.getElementById('path').innerHTML = window.location.hash;
document.getElementById('hostPath').innerHTML = iframeClient.asHostUrl(
window.location.hash
);
};
/**** SET UP THE IFRAME CLIENT LIBRARY ****/
let iframeClient = new Client({
// This lets the example client work with the cli host by setting it's domain
// as a valid host origin to post messages to. A production app will probably
// need to conditionally set this.
hostOrigin: `http://${window.location.hostname}:3000`
});
// Add a listener that will handled config data passed from the host to the
// client at startup.
iframeClient.addListener('environmentalData', envData => {
// Transform link URLs to match top-level app.
transformLinks();
const appLocale = envData.locale;
const now = new Date();
const localizedDate = new Intl.DateTimeFormat(appLocale).format(now);
console.log(