©
이 문서에서는 PHP 중국어 웹사이트 매뉴얼 풀어 주다
Angular's wrapper for window.setTimeout
. The fn
function is wrapped into a try/catch
block and delegates any exceptions to
$exceptionHandler service.
The return value of registering a timeout function is a promise, which will be resolved when the timeout is reached and the timeout function is executed.
To cancel a timeout request, call $timeout.cancel(promise)
.
In tests you can use $timeout.flush()
to
synchronously flush the queue of deferred functions.
$timeout(fn, [delay], [invokeApply]);
参数 | 类型 | 详述 |
---|---|---|
fn | function() |
A function, whose execution should be delayed. |
delay
(可选)
|
number |
Delay in milliseconds. |
invokeApply
(可选)
|
boolean |
If set to |
Promise |
Promise that will be resolved when the timeout is reached. The value this
promise will be resolved with is the return value of the |
cancel([promise]);
Cancels a task associated with the promise
. As a result of this, the promise will be
resolved with a rejection.
参数 | 类型 | 详述 |
---|---|---|
promise
(可选)
|
Promise |
Promise returned by the |
boolean |
返回值 |