Public
Edited
Oct 3, 2024
Insert cell
Insert cell
{
// Run this cell to pass event to targetCell
const event = new CustomEvent("myEvent", {detail: {message: "Hello"}});
document.dispatchEvent(event);
}
Insert cell
targetCell
Insert cell
viewof targetCell = {
const el = htl.html`<div> Hi`
const listener = (event) => {
console.log(event.detail.message);
el.value = event.detail.message;
el.dispatchEvent(new CustomEvent("input"));
};
document.addEventListener("myEvent", listener);
el.value = 'Initial value';
return el;
}
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