UNPKG

@knapsack/app

Version:

Build Design Systems on top of knapsack, by Basalt

32 lines (28 loc) 911 B
var metaTag = document.getElementById('ks-meta'); var metaString = metaTag.innerText; var meta = JSON.parse(metaString); // console.log(`got ks meta!`, meta); var { isInIframe, websocketsPort } = meta; // if (!isInIframe && websocketsPort) { if (websocketsPort) { if ('WebSocket' in window && window.location.hostname === 'localhost') { var socket = new window.WebSocket("ws://localhost:".concat(websocketsPort)); socket.addEventListener('message', function () { window.location.reload(); }); } } if (isInIframe) { /** * Prevents the natural click behavior of any links within the iframe. * Otherwise the iframe reloads with the current page or follows the url provided. */ var links = document.querySelectorAll('a'); links.forEach(link => { link.addEventListener('click', e => { e.preventDefault(); }); }); import('./setup-iframe-b01d320f.mjs'); }