Skip to content

Event_Listeners

Neila edited this page Aug 13, 2024 · 1 revision

Event Listeners

Basic Example

<button $click={event => {
    doSomething();
}}>
    Click here!
</button>

Capture Example

<button capture$click={event => {
    doSomething();
}}>
    Click here!
</button>

Other

Other options like passive, once are like capture, use ...$event to declare.

Combination

<button capture_once$click={event => {
    doSomething();
}}>
    Click here once!
</button>

The order has no impact.

Singal Example

const signal = new AbortSignal();

<button $click={[event => {
    doSomething();
}, signal]}>
    Click here!
</button>
Clone this wiki locally