X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=examples%2Ftypescript%2Fpool.ts;h=869e62a8bf718020c155ae221b85921735a61d74;hb=af64732b38dfd3b66eeabf9d9a27d1b47319f58b;hp=50dcc7b779d7118b27f42c56136fca509d58a7f6;hpb=db274bfd5662a85eb7bbcac6e59701cf00444775;p=poolifier.git diff --git a/examples/typescript/pool.ts b/examples/typescript/pool.ts index 50dcc7b7..869e62a8 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.info('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.info('Worker is online') + } } )