Conversation
src/useTapAway.ts
Outdated
| }; | ||
|
|
||
| events.forEach((eventName) => { | ||
| emitter?.addListener?.(eventName, handler); |
There was a problem hiding this comment.
The bindtap event is not being captured by the global GlobalEventEmitter.
|
Hi, @Coooder-Crypto, thanks for your contribution! However, the current implementation doesn't seem to achieve the goal of
|
|
Happy New Year, @gaoachao. I also want to sincerely apologize first: in my first PR, I started implementing before fully understanding Lynx and the real goal of useTapAway, which increased your review cost. Sorry about that. After studying Lynx more carefully, I rewrote the implementation. In this version:
One known limitation remains: the third parameter is not a react-use style event array yet (e.g. ['click'] / ['mousedown', 'touchstart']). The current contract is tap-only (default is also tap). If you prefer, I can follow up in this PR (or a separate PR) with array-shaped compatibility that still maps to tap internally. BTW, I recently joined ByteDance as a frontend intern. This is my first time implementing a relatively low-level hook, and I’d really like to keep contributing to this repo long-term. Thanks again for your guidance and patient review. |
Added useTapAway and docs for issue #7
Type notes: the hook uses a minimal event shape (target/detail.target) instead of MainThread.TouchEvent because it runs in the background and consumes GlobalEventEmitter payloads, which may not match MTS touch events; consumers can supply a narrower type via the generic if needed. Default event name is bindtap; adjust if runtime uses a different tap event.