本页还没有译文
本页 3 段还没译成Español,下面显示的是英文原文。svelte/events
还没翻译译自英文(svelte.dev)本页 3 段都还没译
import { on } from 'svelte/events';on
Attaches an event handler to the window and returns a function that removes the handler. Using this
rather than addEventListener will preserve the correct order relative to handlers added declaratively
(with attributes like onclick), which use event delegation for performance reasons
function on<Type extends keyof WindowEventMap>(
window: Window,
type: Type,
handler: (
this: Window,
event: WindowEventMap[Type] & { currentTarget: Window }
) => any,
options?: AddEventListenerOptions | undefined
): () => void;function on<Type extends keyof DocumentEventMap>(
document: Document,
type: Type,
handler: (
this: Document,
event: DocumentEventMap[Type] & {
currentTarget: Document;
}
) => any,
options?: AddEventListenerOptions | undefined
): () => void;function on<
Element extends HTMLElement,
Type extends keyof HTMLElementEventMap
>(
element: Element,
type: Type,
handler: (
this: Element,
event: HTMLElementEventMap[Type] & {
currentTarget: Element;
}
) => any,
options?: AddEventListenerOptions | undefined
): () => void;function on<
Element extends MediaQueryList,
Type extends keyof MediaQueryListEventMap
>(
element: Element,
type: Type,
handler: (
this: Element,
event: MediaQueryListEventMap[Type] & {
currentTarget: Element;
}
) => any,
options?: AddEventListenerOptions | undefined
): () => void;function on(
element: EventTarget,
type: string,
handler: EventListener,
options?: AddEventListenerOptions | undefined
): () => void;AI 翻译查看英文原文