One parameter
One Parameter and allow the platform to capture canvas frame for preview
<canvas></canvas>
<script src="https://script.layerstatic.com/layer/sdk-latest.js"></script>
<script src="./app.js"></script>
<script>
const canvas = document.querySelector('canvas');
const app = new App(canvas);
globalThis.addEventListener('layer:paramchange', (event) => {
const { id, value } = event.detail;
if (id === 'choice') app.choice = value;
});
$layer
.registerCanvas(canvas)
.params(
{
customization_level: 'VIEWER',
kind: 'LIST',
id: 'choice',
name: 'List',
default: 'option2',
options: [
{
value: 'option1',
label: 'Option 1',
},
{
value: 'option2',
label: 'Option 2',
},
{
value: 'option3',
label: 'Option 3',
},
],
}
).then(({ choice }) => {
app.choice = choice;
app.start();
});
</script>