Return an observable that emits each item emitted by the source observable after the specified delay.
More...
Go to the source code of this file.
|
template<class... AN> |
auto | rxcpp::operators::delay (AN &&...an) -> operator_factory< delay_tag, AN... > |
| Return an observable that emits each item emitted by the source observable after the specified delay. More...
|
|
Return an observable that emits each item emitted by the source observable after the specified delay.
- Template Parameters
-
Duration | the type of time interval |
Coordination | the type of the scheduler |
- Parameters
-
period | the period of time each item is delayed |
coordination | the scheduler for the delays |
- Returns
- Observable that emits each item emitted by the source observable after the specified delay.
- Sample Code
using namespace std::chrono;
auto start = scheduler.now();
auto period = milliseconds(10);
const auto next = [=](const char* s) {
return [=](long v){
auto t = duration_cast<milliseconds>(scheduler.now() - start);
long long int ms = t.count();
printf("[%s @ %lld] OnNext: %ld\n", s, ms, v);
};
};
values.
next(" delayed"),
[](){printf("OnCompleted\n");});
[ delayed @ 10] OnNext: 1
[ delayed @ 20] OnNext: 2
[ delayed @ 30] OnNext: 3
[ delayed @ 40] OnNext: 4
OnCompleted
#define RXCPP_OPERATORS_RX_DELAY_HPP |