useTouchEmulation
用于从 MouseEvent 合成 TouchEvent 的 hook,使现有基于触摸的事件处理逻辑可以无缝兼容鼠标输入,便于从仅触摸代码迁移。
示例
类型定义
回调前缀会映射到对应的事件绑定模式:
onTouchStart->bindtouchstart和bindmousedowncatchTouchStart->catchtouchstart和catchmousedowncaptureBindTouchStart->capture-bindtouchstart和capture-bindmousedowncaptureCatchTouchStart->capture-catchtouchstart和capture-catchmousedown
追加 MT 可以使用主线程版本,例如 captureCatchTouchStartMT 会映射到 main-thread:capture-catchtouchstart 和 main-thread:capture-catchmousedown。