X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fworker%2FWorkerAbstract.ts;h=7c662d9dead4aa46e519b2519d1e560c774615b8;hb=6114e6f11b3fb12439d464e142fdf93866982b6c;hp=9f16af737457cf5daa522a1d25859514a6b6b3b1;hpb=431c489c2b4b442ffad31573222b910780887495;p=e-mobility-charging-stations-simulator.git diff --git a/src/worker/WorkerAbstract.ts b/src/worker/WorkerAbstract.ts index 9f16af73..7c662d9d 100644 --- a/src/worker/WorkerAbstract.ts +++ b/src/worker/WorkerAbstract.ts @@ -1,20 +1,24 @@ +import Constants from '../utils/Constants'; import { WorkerData } from '../types/Worker'; -export default abstract class WorkerAbstract { - protected workerScript: string; - public abstract size: number; - public abstract maxElementsPerWorker: number; +export default abstract class WorkerAbstract { + protected readonly workerScript: string; + protected readonly workerStartDelay: number; + public abstract readonly size: number; + public abstract readonly maxElementsPerWorker: number | null; /** * `WorkerAbstract` constructor. * - * @param {string} workerScript + * @param workerScript + * @param workerStartDelay */ - constructor(workerScript: string) { + constructor(workerScript: string, workerStartDelay: number = Constants.WORKER_START_DELAY) { this.workerScript = workerScript; + this.workerStartDelay = workerStartDelay; } public abstract start(): Promise; public abstract stop(): Promise; - public abstract addElement(elementData: WorkerData): Promise; + public abstract addElement(elementData: T): Promise; }