feat: Improve dragstart handler installation with retry logic for Angular handlers
This commit is contained in:
parent
e91a2445f3
commit
c32453018b
1 changed files with 12 additions and 2 deletions
|
|
@ -65,9 +65,15 @@
|
||||||
// PART 3: Install OUR dragstart handler in capture phase
|
// PART 3: Install OUR dragstart handler in capture phase
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
setTimeout(function() {
|
function installDragHandler() {
|
||||||
console.log('[Intercept] Installing dragstart handler, have', angularDragHandlers.length, 'Angular handlers');
|
console.log('[Intercept] Installing dragstart handler, have', angularDragHandlers.length, 'Angular handlers');
|
||||||
|
|
||||||
|
if (angularDragHandlers.length === 0) {
|
||||||
|
console.warn('[Intercept] No Angular handlers found yet, will retry in 1s...');
|
||||||
|
setTimeout(installDragHandler, 1000);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Stop intercepting addEventListener
|
// Stop intercepting addEventListener
|
||||||
listenerPatchActive = false;
|
listenerPatchActive = false;
|
||||||
|
|
||||||
|
|
@ -124,7 +130,11 @@
|
||||||
}, true); // Capture phase
|
}, true); // Capture phase
|
||||||
|
|
||||||
console.log('[Intercept] dragstart handler installed ✓');
|
console.log('[Intercept] dragstart handler installed ✓');
|
||||||
}, 1500); // Wait for Angular to register its listeners
|
}
|
||||||
|
|
||||||
|
// Wait for Angular to register its listeners, then install our handler
|
||||||
|
// Start checking after 2 seconds (give Angular time to load on first page load)
|
||||||
|
setTimeout(installDragHandler, 2000);
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// PART 3: QWebChannel connection
|
// PART 3: QWebChannel connection
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue