worktank
Advanced tools
Comparing version 2.5.0 to 2.5.1
@@ -136,3 +136,3 @@ /* IMPORT */ | ||
} | ||
task.promise.finally(() => { | ||
const onFinally = () => { | ||
clearTimeout(timeoutId); | ||
@@ -147,3 +147,4 @@ if (this.terminated) | ||
this.tick(); | ||
}); | ||
}; | ||
task.promise.then(onFinally, onFinally); | ||
worker.exec(task); | ||
@@ -150,0 +151,0 @@ } |
@@ -5,3 +5,3 @@ { | ||
"description": "A simple isomorphic library for executing functions inside WebWorkers or Node Threads pools.", | ||
"version": "2.5.0", | ||
"version": "2.5.1", | ||
"type": "module", | ||
@@ -8,0 +8,0 @@ "main": "dist/index.js", |
@@ -233,3 +233,3 @@ | ||
task.promise.finally ( () => { | ||
const onFinally = (): void => { | ||
@@ -252,4 +252,6 @@ clearTimeout ( timeoutId ); | ||
}); | ||
}; | ||
task.promise.then ( onFinally, onFinally ); | ||
worker.exec ( task ); | ||
@@ -256,0 +258,0 @@ |
@@ -17,2 +17,4 @@ | ||
t.plan ( 3 ); | ||
const pool = new WorkTank ({ | ||
@@ -39,2 +41,12 @@ name: 'example', | ||
try { | ||
await pool.exec ( 'exception' ); | ||
} catch ( error ) { | ||
t.true ( error instanceof Error ); | ||
} | ||
pool.terminate (); | ||
@@ -46,2 +58,4 @@ | ||
t.plan ( 3 ); | ||
const pool = new WorkTank ({ | ||
@@ -60,2 +74,12 @@ name: 'example', | ||
try { | ||
await pool.exec ( 'exception' ); | ||
} catch ( error ) { | ||
t.true ( error instanceof Error ); | ||
} | ||
pool.terminate (); | ||
@@ -67,2 +91,4 @@ | ||
t.plan ( 3 ); | ||
const pool = new WorkTank ({ | ||
@@ -77,2 +103,5 @@ name: 'example', | ||
return a + b; | ||
}, | ||
exception: () => { | ||
throw new Error (); | ||
} | ||
@@ -92,2 +121,12 @@ } | ||
try { | ||
await proxy.exception (); | ||
} catch ( error ) { | ||
t.true ( error instanceof Error ); | ||
} | ||
pool.terminate (); | ||
@@ -94,0 +133,0 @@ |
@@ -16,4 +16,8 @@ | ||
const exception = () => { | ||
throw new Error (); | ||
}; | ||
/* EXPORT */ | ||
export {sep, sum}; | ||
export {sep, sum, exception}; |
37067
856