Mock implementation of the $interval service.
Use $interval.flush(millis)
to
move forward by millis
milliseconds and trigger any functions scheduled to run in that
time.
$interval(fn, delay, [count], [invokeApply], [Pass]);
Param | Type | Details |
---|---|---|
fn | function() |
A function that should be called repeatedly. |
delay | number |
Number of milliseconds between each function call. |
count
(optional)
|
number |
Number of times to repeat. If not set, or 0, will repeat indefinitely. (default: 0) |
invokeApply
(optional)
|
boolean |
If set to (default: true) |
Pass
(optional)
|
* |
additional parameters to the executed function. |
promise | A promise which will be notified on each iteration. |
cancel(promise);
Cancels a task associated with the promise
.
Param | Type | Details |
---|---|---|
promise | promise |
A promise from calling the |
boolean | Returns |
flush([millis]);
Runs interval tasks scheduled to be run in the next millis
milliseconds.
Param | Type | Details |
---|---|---|
millis
(optional)
|
number |
maximum timeout amount to flush up until. |
number | The amount of time moved forward. |