X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=examples%2Ftypescript%2Fpool.ts;h=7268ebdc599cfaf6a8951583c5d06d1ced71f9c3;hb=08f3f44cef6256fdbab1a2a56842b291fd6dcd42;hp=50dcc7b779d7118b27f42c56136fca509d58a7f6;hpb=784b79b089f970e88dd559ed242347d4e86339e5;p=poolifier.git diff --git a/examples/typescript/pool.ts b/examples/typescript/pool.ts index 50dcc7b7..7268ebdc 100644 --- a/examples/typescript/pool.ts +++ b/examples/typescript/pool.ts @@ -1,14 +1,17 @@ -import { DynamicThreadPool, FixedThreadPool } from 'poolifier' -import { MyData, MyResponse } from './worker' - import { join } from 'path' +import type { MyData, MyResponse } from './worker' +import { DynamicThreadPool, FixedThreadPool } from 'poolifier' export const fixedPool = new FixedThreadPool>( 8, join(__dirname, 'worker.js'), { - errorHandler: e => console.error(e), - onlineHandler: () => console.log('Worker is online') + errorHandler: (e: Error) => { + console.error(e) + }, + onlineHandler: () => { + console.log('Worker is online') + } } ) @@ -17,7 +20,11 @@ export const dynamicPool = new DynamicThreadPool>( 8, join(__dirname, 'worker.js'), { - errorHandler: e => console.error(e), - onlineHandler: () => console.log('Worker is online') + errorHandler: (e: Error) => { + console.error(e) + }, + onlineHandler: () => { + console.log('Worker is online') + } } )