import EventEmitter from 'events'
-import type { MessageValue } from '../utility-types'
import type { IWorker } from './abstract-pool'
import type { IPool } from './pool'
*
* Events that can currently be listened to:
*
- * - `'FullPool'`
+ * - `'busy'`
*/
readonly emitter: PoolEmitter
- /**
- * Maximum number of workers that can be created by this pool.
- */
- readonly max?: number
-
/**
* Whether the pool is dynamic or not.
*
* If it is dynamic, it provides the `max` property.
*/
- isDynamic(): boolean
-
- /**
- * Creates a new worker for this pool and sets it up completely.
- *
- * @returns New, completely set up worker.
- */
- createAndSetupWorker(): Worker
-
- /**
- * Shut down given worker.
- *
- * @param worker A worker within `workers`.
- */
- destroyWorker(worker: Worker): void | Promise<void>
+ readonly dynamic: boolean
/**
- * Register a listener callback on a given worker.
- *
- * @param worker A worker.
- * @param listener A message listener callback.
+ * Maximum number of workers that can be created by this pool.
*/
- registerWorkerMessageListener<Message extends Data | Response>(
- worker: Worker,
- listener: (message: MessageValue<Message>) => void
- ): void
+ readonly max?: number
}