Terminate web worker on error

This commit is contained in:
casperlamboo 2017-07-24 15:40:54 +02:00
parent cb465b9eee
commit 4a61164af9

View File

@ -46,7 +46,11 @@ function sliceAsync(settings, geometry, onProgress) {
return new Promise((resolve, reject) => {
// create the slicer worker
const slicerWorker = new SlicerWorker();
slicerWorker.onerror = reject;
slicerWorker.onerror = error => {
slicerWorker.terminate();
reject(error);
};
// listen to messages send from worker
slicerWorker.addEventListener('message', (event) => {