Public
Edited
Dec 6, 2023
Insert cell
Insert cell
inputApiKey = newApiKeyInput()
Insert cell
Insert cell
Insert cell
Insert cell
{
let submit = 0;
const screenshotContainer = htl.html`<div><p>Waiting for a new URL...</p></div>`;
yield screenshotContainer;

for await (let info of Generators.input(viewof urlSubmitForm)) {
if (submit === info.submit) continue;
submit = info.submit;
const url = info.url;
if (!url) {
screenshotContainer.innerHTML = "";
screenshotContainer.append(
htl.html`<p>URL is empty. Waiting for a new one...</p>`
);
continue;
}
const win = await api.windows.create({
url,
focused: true,
type: "popup",
width: 800,
height: 600
});
try {
await Promises.delay(info.timeout);
const imgUrl = await api.tabs.captureVisibleTab(win.id, {
format: "png"
});
const img = htl.html`<img src="${imgUrl}" />`;
screenshotContainer.innerText = "";
screenshotContainer.appendChild(img);
} finally {
await api.windows.remove(win.id);
}
}
}
Insert cell
import { loadApi, newApiKeyInput } from "@kotelnikov/webrun-devtools"
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