OneShotRegistration for cancelling the one-shot.registerOneShot
Register a one-shot delegate handler on a Hap that detaches itself after the first invocation.
The registration is consumed before the user handler runs. This prevents re-entrant emits from re-triggering the same one-shot handler. If the user handler throws, the registration is already consumed and will not fire again.
The returned OneShotRegistration can cancel the one-shot before it fires.
Parameters
hap | The hap to register on. |
handler | The delegate handler that runs at most once. |
Returns
An
fn
auto registerOneShot(Args...)(ref NothrowHap!Args hap, void delegate(Args) @safe nothrow handler) @safe nothrowditto