(udid: string, message: ControlMessage)
| 2252 | }, []); |
| 2253 | |
| 2254 | function sendControl(udid: string, message: ControlMessage): boolean { |
| 2255 | if (isMoveControlMessage(message)) { |
| 2256 | pendingControlMoveRef.current = { message, udid }; |
| 2257 | if (!controlMoveFrameRef.current) { |
| 2258 | controlMoveFrameRef.current = window.requestAnimationFrame(() => { |
| 2259 | controlMoveFrameRef.current = 0; |
| 2260 | flushPendingControlMove(); |
| 2261 | }); |
| 2262 | } |
| 2263 | return true; |
| 2264 | } |
| 2265 | flushPendingControlMove(); |
| 2266 | return sendControlNow(udid, message); |
| 2267 | } |
| 2268 | |
| 2269 | function sendTouchControl(udid: string, phase: TouchPhase, coords: Point) { |
| 2270 | sendControl(udid, { type: "touch", ...coords, phase }); |
no test coverage detected