observableObject

Wraps subscribe method in virtual function.

template observableObject(E)
observableObject
(
R
)
(
auto ref R observable
)

Members

Functions

observableObject
Observable!E observableObject(R observable)
Undocumented in source. Be warned that the author may not have intended to support it.

Examples

int subscribeCount = 0;
class TestObservable : Observable!int
{
    Disposable subscribe(Observer!int observer)
    {
        subscribeCount++;
        return NopDisposable.instance;
    }
}

auto test = new TestObservable;
auto observable = observableObject!int(test);
assert(observable is test);
assert(subscribeCount == 0);
auto d = observable.subscribe(null);
assert(subscribeCount == 1);

Meta