class
EventHandler::Subscriptions
- EventHandler::Subscriptions
- Reference
- Object
Overview
A bag of Subscriptions that are torn down together. #on adds a tracked
subscription and returns it, so a single one can still be re-armed or
cancelled individually; #off cancels every remaining one, idempotently.
Defined in:
subscription.crInstance Method Summary
-
#dispose : Nil
#dispose/#disposed?aliases of#off/#empty?. -
#disposed? : Bool
:ditto: — whether the bag has been torn down (holds no subscriptions).
-
#empty? : Bool
Whether the bag holds no subscriptions.
-
#off : Nil
Cancels every tracked subscription and empties the bag.
-
#on(target, type : T.class, once = false, async = ::EventHandler.async?, at = ::EventHandler.at_end, &block : T -> Nil) : Subscription forall T
Subscribes block to type on target, tracking it for a later bulk
#off.
Instance Method Detail
def on(target, type : T.class, once = false, async = ::EventHandler.async?, at = ::EventHandler.at_end, &block : T -> Nil) : Subscription forall T
#
Subscribes block to type on target, tracking it for a later bulk
#off. Returns the created Subscription.