Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(parent: ITaskWithStatus, ticks: number) {
this.parent = parent;
this.ticks = ticks;
this.percentCompleteInternal = 0;
if (this.ticks < 0 || this.ticks > TaskProgress.ONE_HUNDRED_PERCENT) {
throw new ImperativeError({msg: "Ticks must be between 0 and 100"});
}
}
public set percentComplete(percentComplete: number) {
const delta = percentComplete - this.percentCompleteInternal;
this.percentCompleteInternal = percentComplete;
this.parent.percentComplete = this.parent.percentComplete + delta * (this.ticks / TaskProgress.ONE_HUNDRED_PERCENT);
}