Subscribable (Core)#
alts.core.subscribable
- class DelayedPublisher[source]#
Bases:
PublisherDescriptionA DelayedPublisher, as opposed to a Publisher, updates through theupdate()method only if it has been requested by executing therequest_update()method after the last successful update.
- class Publisher[source]#
Bases:
Configurable,SubscribableDescriptionA Publisher is a simple Subscribable which just calls the subscribers’ callables when updated.- subscribe(self, subscriber, callable) None[source]#
- DescriptionAdds the
(subscriber, callable)tuple to its record.If no callable is passed, defaults tosubscriber.update.- Parameters:
subscriber (Subscriber) – The new subscriber
callable (Callable) – Gets called on update (default=
subscriber.update)
- class Subscribable[source]#
Bases:
objectDescriptionA Subscribable can have subscribers. When the Subscribable is updated, it calls the given Callable for each subscriber.- abstract subscribe(self, subscriber, callable) None[source]#
- DescriptionRemembers
subscriberand calls the givencallableif one is given.- Parameters:
subscriber (Subscriber) – The new subscriber
callable (Callable) – This gets called when the Subscribable updates (default= None)
- Raises:
NotImplementedError – Method is abstract