MCPcopy Create free account
hub / github.com/apache/cloudstack / _captureProxy

Function _captureProxy

systemvm/agent/noVNC/core/util/events.js:26–53  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

24let _elementForUnflushedEvents = null;
25document.captureElement = null;
26function _captureProxy(e) {
27 // Recursion protection as we'll see our own event
28 if (_captureRecursion) return;
29
30 // Clone the event as we cannot dispatch an already dispatched event
31 const newEv = new e.constructor(e.type, e);
32
33 _captureRecursion = true;
34 if (document.captureElement) {
35 document.captureElement.dispatchEvent(newEv);
36 } else {
37 _elementForUnflushedEvents.dispatchEvent(newEv);
38 }
39 _captureRecursion = false;
40
41 // Avoid double events
42 e.stopPropagation();
43
44 // Respect the wishes of the redirected event handlers
45 if (newEv.defaultPrevented) {
46 e.preventDefault();
47 }
48
49 // Implicitly release the capture on button release
50 if (e.type === "mouseup") {
51 releaseCapture();
52 }
53}
54
55// Follow cursor style of target element
56function _capturedElemChanged() {

Callers

nothing calls this directly

Calls 2

releaseCaptureFunction · 0.85
dispatchEventMethod · 0.80

Tested by

no test coverage detected