histogram.ts 517 字节
Newer Older
P
Peter Pan 已提交
1
import type {Data, Worker} from './types';
P
Peter Pan 已提交
2 3 4 5 6 7 8

const worker: Worker = async io => {
    const components = await io.getData<string[]>('/components');
    if (!components.includes('histogram')) {
        return;
    }

P
Peter Pan 已提交
9
    const {runs, tags} = await io.save<Data>('/histogram/tags');
P
Peter Pan 已提交
10
    const q = [];
P
Peter Pan 已提交
11 12
    for (const [index, run] of runs.entries()) {
        for (const tag of tags[index]) {
P
Peter Pan 已提交
13 14 15 16 17 18 19
            q.push(io.save('/histogram/list', {run, tag}));
        }
    }
    await Promise.all(q);
};

export default worker;