All files / src/analysis/worker gram.worker.ts

0% Statements 0/5
100% Branches 1/1
100% Functions 1/1
0% Lines 0/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20                                       
/**
 * A helper for the correlation matrix (ยง18.6, `analysis/pearsonThreads.ts`).
 *
 * Sent one stretch of rows and every row after it, it correlates the stretch
 * and sends each band's lines back as it finishes (`runGramJob`). One job per
 * worker: the thread that started it terminates it when the matrix is done, or
 * stopped.
 */
 
import { runGramJob, type GramJob, type GramMessage } from '../pearsonThreads'
 
const scope = self as unknown as {
  onmessage: ((event: MessageEvent<GramJob>) => void) | null
  postMessage(message: GramMessage, transfer?: Transferable[]): void
}
 
scope.onmessage = (event) => {
  runGramJob(event.data, (message, transfer) => scope.postMessage(message, transfer ?? []))
}