edan20-assignment3 / lib /worker.js
lkmill's picture
silly first implementation of workers
dc2b31f
Raw History Blame Contribute Delete
257 Bytes
import * as bpe from './bpe.js'
import * as unigramLM from './unigram_lm.js'
import * as util from './util.js'
const fns = {
...bpe,
...unigramLM,
...util,
}
onmessage = ({ data }) => {
const { fn, args } = data
postMessage(fns[fn](...args))
}