©
本文档使用 PHP中文网手册 发布
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]);
参数 | 类型 | 详述 |
---|---|---|
fn | function() |
A function that should be called repeatedly. |
delay | number |
Number of milliseconds between each function call. |
count
(可选)
|
number |
Number of times to repeat. If not set, or 0, will repeat indefinitely. |
invokeApply
(可选)
|
boolean |
If set to |
promise |
A promise which will be notified on each iteration. |
cancel(promise);
Cancels a task associated with the promise
.
参数 | 类型 | 详述 |
---|---|---|
promise | promise |
A promise from calling the |
boolean |
返回值 |
flush([millis]);
Runs interval tasks scheduled to be run in the next millis
milliseconds.
参数 | 类型 | 详述 |
---|---|---|
millis
(可选)
|
number |
maximum timeout amount to flush up until. |
number |
The amount of time moved forward. |