Published
Edited
Jun 7, 2022
1 star
Also listed in…
Tips and Utilities
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
lb = import('https://unpkg.com/@liveblocks/client@0.16.15/index.mjs?module')
Insert cell
client = lb.createClient({
publicApiKey: Secret("liveblockskey")
});
Insert cell
{
globalThis.process = { env: { NODE_ENV: 'production' } } // hack to get around code need for process variable.
const room = client.enter("your-room-id");

room.subscribe("others", (others) => {
if (others.count === 0) {
container.innerHTML = "You're the only one here.";
} else if (others.count === 1) {
container.innerHTML = "There is one other person here.";
} else {
container.innerHTML = "There are " + others.count + " other people here.";
}
});
}
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