mirror of
https://github.com/simonbrunel/qtpromise.git
synced 2025-04-18 23:51:08 +08:00
GitBook development seems a bit stuck right now so let's switch to VuePress which, IMO, is more user friendly. Update the documentation to include the version number in which features were added and use custom container to display notes and warnings.
21 lines
499 B
Markdown
21 lines
499 B
Markdown
---
|
|
title: .delay
|
|
---
|
|
|
|
# QPromise::delay
|
|
|
|
*Since: 0.2.0*
|
|
|
|
```cpp
|
|
QPromise<T>::delay(int msec) -> QPromise<T>
|
|
```
|
|
|
|
This method returns a promise that will be fulfilled with the same value as the `input` promise and after at least `msec` milliseconds. If the `input` promise is rejected, the `output` promise is immediately rejected with the same reason.
|
|
|
|
```cpp
|
|
QPromise<int> input = {...}
|
|
auto output = input.delay(2000).then([](int res) {
|
|
// called 2 seconds after `input` is fulfilled
|
|
});
|
|
```
|