): void
/**
- * Register a listener callback on a given worker.
+ * Registers a listener callback on a given worker.
*
* @param worker A worker.
* @param listener A message listener callback.
*/
export interface IPool<Data = unknown, Response = unknown> {
/**
- * Perform the task specified in the constructor with the data parameter.
+ * Performs the task specified in the constructor with the data parameter.
*
* @param data The input for the specified task. This can only be serializable data.
* @returns Promise that will be resolved when the task is successfully completed.
*/
destroy(): Promise<void>
/**
- * Set the worker choice strategy in this pool.
+ * Sets the worker choice strategy in this pool.
*
* @param workerChoiceStrategy The worker choice strategy.
*/
}
/**
- * Compute workers last virtual task timestamp.
+ * Computes workers last virtual task timestamp.
*/
private updateWorkerLastVirtualTaskTimestamp () {
for (const worker of this.pool.workers) {
*/
requiredStatistics: RequiredStatistics
/**
- * Choose a worker in the pool.
+ * Chooses a worker in the pool.
*/
choose(): Worker
}
}
/**
- * Get the worker choice strategy instance specific to the pool type.
+ * Gets the worker choice strategy instance specific to the pool type.
*
* @param workerChoiceStrategy The worker choice strategy.
* @returns The worker choice strategy instance for the pool type.
}
/**
- * Get the worker choice strategy used in the context.
+ * Gets the worker choice strategy used in the context.
*
* @returns The worker choice strategy.
*/
}
/**
- * Set the worker choice strategy to use in the context.
+ * Sets the worker choice strategy to use in the context.
*
* @param workerChoiceStrategy The worker choice strategy to set.
*/
}
/**
- * Choose a worker with the underlying selection strategy.
+ * Chooses a worker with the underlying selection strategy.
*
* @returns The chosen one.
*/