Event Listeners


Etcher simplifies the process of add event listeners to elements. You can add event listeners to any element by using the @event directive.

Example

Say we want to pop up an alert when a button is clicked. We can do this by adding an @click event listener to the button.

<button @click={() => {alert('Hello, world!')}}>Click me!</button>

The @event attribute syntax tells etcher to add an event listener on this element at runtime. The value of the attribute is wrapped in curly braces and should be a callable expression.