ReplayHap.attach

void attach(Handler handler) @safe

Attach a delegate handler. If a value has been emitted, the handler is invoked immediately with the stored value.

The synchronous replay happens even while an emit on this hap is in flight: the new handler receives the stored value right away and is not invoked again by the in-flight dispatch. This is a deliberate exception to the core rule that a handler attached during emit runs only on a later emit.

Parameters

handlerDelegate handler to attach; null is ignored.
void attach(FunctionHandler handler) @safe

Attach a free-function handler. If a value has been emitted, the handler is invoked immediately with the stored value.

Parameters

handlerFree-function handler to attach; null is ignored.