Releases: AndersCan/typed-web-workers
Releases · AndersCan/typed-web-workers
4.0.0
3.0.0
BREAKING CHANGE: createWorker
: now takes named parameters of type ICreateWorkerProps
.
BREAKING CHANGE: workerFunction
: now takes named parameters: {input, callback, getState, setState}
workerFunction
: added getState
and setState
params.
added importScripts
for importing scripts in worker
added onError
when an unhandled exception is thrown
createWorker({
workerFunction: ({input, callback, getState, setState}) => {...},
onMessage: output => {...},
onError: error => {...},
importScripts: ['https://www.url.to/your/script.js']
})
Only workerFunction
is required in ICreateWorkerProps
.
onError
- called when an unhandled exception is thrown
importScripts
- imports commonjs/umd scripts.