跳到主要内容

React DOM event handle types

React DOM 事件处理类型

import type { ReactScopeInstance } from 'shared/ReactTypes';
import type { DOMEventName } from '../events/DOMEventNames';
import { SyntheticEvent } from '../events/SyntheticEvent';

// ReactDOM事件处理器
export type ReactDOMEventHandle = (
target: EventTarget | ReactScopeInstance,
callback: (se: typeof SyntheticEvent) => void,
) => () => void;

// ReactDOM事件处理监听器
export type ReactDOMEventHandleListener = {
callback: (se: typeof SyntheticEvent) => void;
capture: boolean;
type: DOMEventName;
};