1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-03 17:49:39 +02:00

Also process existing pending callbacks

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1629
This commit is contained in:
Raymond Hill 2021-06-14 07:36:49 -04:00
parent 2693f4e0c2
commit 581e9a1c0c
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -79,11 +79,17 @@
dl.hide.end();
}
if ( typeof dl.push === 'function' ) {
dl.push = function(o) {
if ( o instanceof Object && typeof o.eventCallback === 'function' ) {
setTimeout(o.eventCallback, 1);
}
const doCallback = function(item) {
if ( item instanceof Object === false ) { return; }
if ( typeof item.eventCallback !== 'function' ) { return; }
setTimeout(item.eventCallback, 1);
};
if ( Array.isArray(dl) ) {
for ( const item of dl ) {
doCallback(item);
}
}
dl.push = item => doCallback(item);
}
}
// empty ga queue