observeOn

ObserveOnObservable!(TObservable, TScheduler)
observeOn
(
TObservable
TScheduler : Scheduler
)
(
auto ref TObservable observable
,
TScheduler scheduler
)

Examples

import std.concurrency;
import rx.subject;

auto subject = new SubjectObject!int;
auto scheduler = new ImmediateScheduler;
auto scheduled = subject.observeOn(scheduler);

import std.array : appender;

auto buf = appender!(int[]);
auto observer = observerObject!int(buf);

auto d1 = scheduled.subscribe(buf);
auto d2 = scheduled.subscribe(observer);

subject.put(0);
assert(buf.data.length == 2);

subject.put(1);
assert(buf.data.length == 4);

Meta