clearDelegatedEvents
Removes the delegated listeners delegateEvents installed on target.
Removes the delegated listeners delegateEvents installed on target. Delegated handlers stop
running until delegateEvents is called again (Solid's clearDelegatedEvents). Use it when a page
unmounts ShadowJS entirely, for example a micro-frontend that hands the document back. A document
without delegated listeners is left as is.
Import#
ts
import { clearDelegatedEvents } from "@shadow-js/web";
Signature#
ts
function clearDelegatedEvents(target: Document = globalThis.document): void
Parameters#
| Name | Description |
|---|---|
target |
Document whose listeners are removed. Default: the global document. |
Examples#
ts
import { clearDelegatedEvents } from "@shadow-js/web";
export function unmountApp(dispose: () => void): void {
dispose();
clearDelegatedEvents();
}