Skip to content

Commit

Permalink
feat: repeat the task indefinitely if the itteration is not defined
Browse files Browse the repository at this point in the history
itteration now accepts null value. if null the itterations will run indefinitely
  • Loading branch information
electather committed Aug 29, 2021
1 parent 3803543 commit 0134c3b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/TaskRepeater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class TaskRepeater {
* @private
* @memberof TaskRepeater
*/
private iteration = 1;
private iteration: number | null = null;

/**
* period in milliseconds
Expand Down Expand Up @@ -90,7 +90,7 @@ class TaskRepeater {
// for finite tasks, repeats the functions
// if the call counter is less than requested iteration

if (Object.prototype.hasOwnProperty.call(this, 'iteration') && this.counter >= this.iteration) {
if (Object.prototype.hasOwnProperty.call(this, 'iteration') && this.iteration && this.counter >= this.iteration) {
// terminates the function and returns the current object
this.cleanupFn(this.counter);
return this;
Expand Down

0 comments on commit 0134c3b

Please sign in to comment.