function / @typed/template/EventHandler

stopPropagation

Modifies an EventHandler to call stopPropagation() on the event.

Package version
1.0.0-beta.7
Category
Propagation control
Since
1.0.0

Import

import { stopPropagation } from "@typed/template/EventHandler";

Signatures

export declare function stopPropagation<Ev extends Event, E = never, R = never>(handler: EventHandler<Ev, E, R>): EventHandler<Ev, E, R>;

Why

This records native bubbling behavior on the inert handler description. EventSource later applies it through the same forwarding event Proxy used for every delegated handler.

Ownership and lifetime

The returned description is inert; the renderer Scope owns its listener.

Examples

import * as EventHandler from "@typed/template/EventHandler"

const handler = EventHandler.make((event) => {
  console.log("Event stopped")
})

const stopPropHandler = EventHandler.stopPropagation(handler)

Other public imports

These import paths expose the same declaration. Each page retains its own public name and signature.

Source