geogebra-component.js

Example: event listeners

When you click point A, its colour changes.

const app = document.getElementById('applet');

async function go() {
    await customElements.whenDefined('geogebra-applet');
    const a = await app.get_object('A');
    a.on('click',() => {
        a.color = `hsl(${Math.random()*360}, 70%, 70%)`;
    });
}
go();