* Call after each touch event. If a rage tap is detected, a `ui.multiClick` * breadcrumb is emitted automatically.
(touchPath: TouchedComponentInfo[], label?: string)
| 66 | * breadcrumb is emitted automatically. |
| 67 | */ |
| 68 | public check(touchPath: TouchedComponentInfo[], label?: string): void { |
| 69 | if (!this._enabled) { |
| 70 | return; |
| 71 | } |
| 72 | |
| 73 | const root = touchPath[0]; |
| 74 | if (!root) { |
| 75 | return; |
| 76 | } |
| 77 | |
| 78 | const identity = getTapIdentity(root, label); |
| 79 | const now = Date.now(); |
| 80 | const tapCount = this._detect(identity, now); |
| 81 | |
| 82 | if (tapCount > 0) { |
| 83 | const message = buildTouchMessage(root, label); |
| 84 | const node = buildNodeFromTouchPath(root, label); |
| 85 | |
| 86 | addBreadcrumb({ |
| 87 | category: 'ui.multiClick', |
| 88 | type: 'default', |
| 89 | message, |
| 90 | data: { |
| 91 | clickCount: tapCount, |
| 92 | metric: true, |
| 93 | route: getCurrentRoute(), |
| 94 | node, |
| 95 | path: touchPath, |
| 96 | }, |
| 97 | }); |
| 98 | |
| 99 | debug.log(`[TouchEvents] Rage tap detected: ${tapCount} taps on ${message}`); |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | /** |
| 104 | * Returns the tap count if rage tap is detected, 0 otherwise. |
no test coverage detected