Published
Edited
Feb 10, 2022
4 stars
Insert cell
Insert cell
component()
Insert cell
Insert cell
function ObsComponent() {
return class ObsComponent extends HTMLElement {
constructor() {
super();
const contentType = this.getAttribute("type") ? this.getAttribute("type") : "";
const root = this.attachShadow({mode: "open"});
root.innerHTML = `
<style>
${styles}
</style>
<div class="container">
<h3>Web Component</h3>
</div>
`;
}
}
}
Insert cell
Insert cell
debug = true
Insert cell
component = function(type) {
const tagName = "obs-component" + (debug ? Math.random() : "");
if (customElements.get(tagName) === undefined) {
customElements.define(tagName, ObsComponent());
}
return html`<${tagName} type="${type ? type : ''}"/>`
}
Insert cell
styles = `
.container {
background: magenta;
}

`
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more