Public
Edited
Sep 21, 2024
Importers
1 star
Insert cell
Insert cell
Insert cell
importByMap = (code, esmap) => {
const url = `data:text/javascript;base64,${btoa(code)}`
const proxy = htl.html`<iframe style="display:none">`
document.body.appendChild(proxy)
invalidation.then(()=> proxy.remove())

return new Promise((resolve, reject) => {
proxy.contentWindow.__resolve = resolve
proxy.contentWindow.__reject = reject
proxy.contentWindow.document.write(`
<script async type="importmap">${JSON.stringify(esmap)}</script>
<script async crossorigin="anonymous"
src="https://ga.jspm.io/npm:es-module-shims@1.10.0/dist/es-module-shims.js"></script>
<script>onerror = __reject</script>
<script async type="module">
import("${url}").then(__resolve, __reject)
</script>`)})
}
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more