mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
Ensure pending callbacks are called only once
This commit is contained in:
parent
10efc35610
commit
0dbe581c5b
1 changed files with 7 additions and 3 deletions
|
|
@ -85,16 +85,20 @@
|
|||
setTimeout(item.eventCallback, 1);
|
||||
};
|
||||
if ( Array.isArray(dl) ) {
|
||||
for ( const item of dl ) {
|
||||
dl.push = item => doCallback(item);
|
||||
const q = dl.slice();
|
||||
dl.length = 0;
|
||||
for ( const item of q ) {
|
||||
doCallback(item);
|
||||
}
|
||||
}
|
||||
dl.push = item => doCallback(item);
|
||||
}
|
||||
}
|
||||
// empty ga queue
|
||||
if ( gaQueue instanceof Function && Array.isArray(gaQueue.q) ) {
|
||||
for ( const entry of gaQueue.q ) {
|
||||
const q = gaQueue.q.slice();
|
||||
gaQueue.q.length = 0;
|
||||
for ( const entry of q ) {
|
||||
ga(...entry);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue