MCPcopy
hub / github.com/adobe/react-spectrum / setup

Method setup

packages/react-aria/src/dnd/DragManager.ts:194–210  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

192 }
193
194 setup(): void {
195 document.addEventListener('keydown', this.onKeyDown, true);
196 document.addEventListener('keyup', this.onKeyUp, true);
197 window.addEventListener('focus', this.onFocus, true);
198 window.addEventListener('blur', this.onBlur, true);
199 document.addEventListener('click', this.onClick, true);
200 document.addEventListener('pointerdown', this.onPointerDown, true);
201
202 for (let event of CANCELED_EVENTS) {
203 document.addEventListener(event, this.cancelEvent, true);
204 }
205
206 this.mutationObserver = new MutationObserver(() => this.updateValidDropTargets());
207 this.updateValidDropTargets();
208
209 announce(this.stringFormatter.format(MESSAGES[getDragModality()]));
210 }
211
212 teardown(): void {
213 document.removeEventListener('keydown', this.onKeyDown, true);

Calls 5

announceFunction · 0.90
getDragModalityFunction · 0.90
addEventListenerMethod · 0.80
formatMethod · 0.45

Tested by

no test coverage detected