How to terminate the worker?
rssfrncsrenishaw opened this issue · 6 comments
How to terminate the worker? The API that is returned by both createWorker and insideWorker does not include terminate.
Maybe the following?
// worker
terminate: function() {
worker.terminate();
}
// fallback
terminate: function() {
document.head.removeChild(script);
window[randomId] = undefined;
}
Note sure that fallback will work in all of the cases
@ai okay that's fine but do you think this is something you would be happy to support? Termination is rather important in cases where workers are tied to the life of something potentially short lived such as a React component.
@rssfrncsrenishaw honestly, this library is just an example for the article :)
@ai haha actually I didn't arrive at this repo from an article and skipped straight past the intro to the "usage" section... Just had a look at the article :)
Do you think this is fine for production? It's working well for me.
Are you happy for PRs or would you rather people just forked for their own requirements?
Do you think this is fine for production? It's working well for me.
Yeap.
Are you happy for PRs or would you rather people just forked for their own requirements?
I will accept and release PR. It is a real project anyway.