X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fpool.ts;h=f1da5356a2e5310d799b6e595a898a3aad783600;hb=7cd8af0033b35def46016a78ea9be1ee516480bf;hp=8a5e505f4f2d23909db36ef3d66e987eee9e9afd;hpb=fc3e65861bc1939ae047ee1e8e91a1ce577035f4;p=poolifier.git diff --git a/src/pools/pool.ts b/src/pools/pool.ts index 8a5e505f..f1da5356 100644 --- a/src/pools/pool.ts +++ b/src/pools/pool.ts @@ -12,6 +12,19 @@ import type { WorkerChoiceStrategy } from './selection-strategies/selection-stra */ export class PoolEmitter extends EventEmitter {} +/** + * Enumeration of pool events. + */ +export const PoolEvents = Object.freeze({ + full: 'full', + busy: 'busy' +} as const) + +/** + * Pool event. + */ +export type PoolEvent = keyof typeof PoolEvents + /** * Options for a poolifier pool. */ @@ -56,7 +69,8 @@ export interface IPool { * * Events that can currently be listened to: * - * - `'busy'` + * - `'full'`: Emitted when the pool is dynamic and full. + * - `'busy'`: Emitted when the pool is busy. */ readonly emitter?: PoolEmitter /**