push
github
236 of 1746 branches covered (13.52%)
5 of 11 new or added lines in 1 file covered. (45.45%)
1834 existing lines in 27 files now uncovered.370 of 2210 relevant lines covered (16.74%)
0.59 hits per line
1 |
import { deferred } from "./utils.js"; |
|
2 |
|
|
3 |
const queue = new Set();
|
2✔ |
4 |
export function add(fn) { |
|
UNCOV
5
|
if (!queue.size) deferred.then(execute);
|
|
UNCOV
6
|
queue.add(fn); |
× |
7 |
} |
|
8 |
|
|
9 |
export function clear(fn) { |
|
UNCOV
10
|
queue.delete(fn);
|
× |
11 |
} |
|
12 |
|
|
13 |
function execute() { |
|
UNCOV
14
|
for (const fn of queue) {
|
× |
UNCOV
15
|
try {
|
× |
UNCOV
16
|
fn(); |
× |
17 |
} catch (e) {
|
|
UNCOV
18
|
console.error(e); |
× |
19 |
} |
|
20 |
} |
|
21 |
|
|
UNCOV
22
|
queue.clear(); |
× |
23 |
} |