MCPcopy
hub / github.com/react/react / setPointerEvent

Function setPointerEvent

packages/dom-event-testing-library/domEnvironment.js:22–37  ·  view source on GitHub ↗
(bool)

Source from the content-addressed store, hash-verified

20}
21
22export function setPointerEvent(bool) {
23 const pointerCaptureFn = name => id => {
24 if (typeof id !== 'number') {
25 if (__DEV__) {
26 console.error('A pointerId must be passed to "%s"', name);
27 }
28 }
29 };
30 global.PointerEvent = bool ? emptyFunction : undefined;
31 global.HTMLElement.prototype.setPointerCapture = bool
32 ? pointerCaptureFn('setPointerCapture')
33 : undefined;
34 global.HTMLElement.prototype.releasePointerCapture = bool
35 ? pointerCaptureFn('releasePointerCapture')
36 : undefined;
37}
38
39/**
40 * Change environment host platform.

Callers 1

describeWithPointerEventFunction · 0.90

Calls 1

pointerCaptureFnFunction · 0.85

Tested by

no test coverage detected