Enable Dynamic Configuration
How to make your app configurable in Studio
async function init() {
// Configure the SDK with the specified host and project ID
configure({
host,
projectId,
});
// Retrieve the project details
const project = await getProject();
document.querySelector("h1").innerText = project.fields.app_title;
// Retrieve the event details
const event = await getEvent(eventId);
// Fetch the elements for the event
const elements = await getElements(event);
// Identify the most recent published poll element
const poll = elements.reverse().find(({ type }) => type === "poll");
if (poll !== undefined) {
// Render and set up the poll
renderPoll(poll);
setupPoll(poll, event);
} else {
// Display a warning callout message if no poll is detected
document.getElementById("app").innerHTML =
"No poll was found in this event. Please consider adding a poll to the event.";
}
}
Last updated

