refactor: add PoolEvents/PoolEvent types
[poolifier.git] / src / pools / pool.ts
index 600cb4228b0b33da08a6cea5c13093ca790f1835..f1da5356a2e5310d799b6e595a898a3aad783600 100644 (file)
@@ -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.
  */