MCPcopy
hub / github.com/facebook/react / pointercancel

Function pointercancel

packages/dom-event-testing-library/domEventSequences.js:175–197  ·  view source on GitHub ↗
(target, defaultPayload)

Source from the content-addressed store, hash-verified

173}
174
175export function pointercancel(target, defaultPayload) {
176 const dispatchEvent = arg => target.dispatchEvent(arg);
177 const pointerType = getPointerType(defaultPayload);
178
179 const payload = {
180 pointerId: defaultPointerId,
181 pointerType,
182 ...defaultPayload,
183 };
184
185 if (hasPointerEvent()) {
186 dispatchEvent(domEvents.pointercancel(payload));
187 } else {
188 if (pointerType === 'mouse') {
189 dispatchEvent(domEvents.dragstart(payload));
190 } else {
191 const touch = createTouch(target, payload);
192 touchStore.removeTouch(touch);
193 const touchEventPayload = createTouchEventPayload(target, touch, payload);
194 dispatchEvent(domEvents.touchcancel(touchEventPayload));
195 }
196 }
197}
198
199export function pointerdown(target, defaultPayload) {
200 const dispatch = arg => target.dispatchEvent(arg);

Callers

nothing calls this directly

Calls 5

hasPointerEventFunction · 0.90
getPointerTypeFunction · 0.85
createTouchFunction · 0.85
createTouchEventPayloadFunction · 0.85
dispatchEventFunction · 0.70

Tested by

no test coverage detected