MCPcopy Create free account
hub / github.com/testing-library/user-event / new

Method new

src/system/pointer/index.ts:35–60  ·  view source on GitHub ↗
(pointerName: string, pointerType: string, buttons: Buttons)

Source from the content-addressed store, hash-verified

33 private nextId = 1
34
35 new(pointerName: string, pointerType: string, buttons: Buttons) {
36 const isPrimary =
37 pointerType !== 'touch' ||
38 !Object.values(this.registry).some(
39 p => p.pointerType === 'touch' && !p.isCancelled,
40 )
41
42 if (!isPrimary) {
43 Object.values(this.registry).forEach(p => {
44 if (p.pointerType === pointerType && !p.isCancelled) {
45 p.isMultitouch = true
46 }
47 })
48 }
49
50 this.registry[pointerName] = new Pointer(
51 {
52 pointerId: this.nextId++,
53 pointerType,
54 isPrimary,
55 },
56 buttons,
57 )
58
59 return this.registry[pointerName]
60 }
61
62 get(pointerName: string) {
63 if (!this.has(pointerName)) {

Callers 2

constructorMethod · 0.80
pressMethod · 0.80

Calls 1

valuesMethod · 0.80

Tested by

no test coverage detected