Table of Contents

Class: Value ./src/peak/events/

Broadcast changes in a variable to all observers

events.Value() instances implement a near-trivial version of the Observer pattern: callbacks can be informed that a change has been made to the Value. Example:

        aValue = events.Value(42)
        assert aValue()==42
        aValue.set(78)  # fires any registered callbacks
        aValue.set(78)  # doesn't fire, value hasn't changed
        aValue.set(78,force=True)   # force firing even though value's the same

Events are broadcast to all callbacks, whether they "accept" or "reject" the event, and tasks yielding to a Value are suspended until the next event is broadcast. The current value of the Value is supplied to callbacks and tasks via the event parameter, and the Value itself is supplied as the source. (See events.IEventSink.)

Base Classes   
__init__ ( self,  value=NOT_GIVEN )

Table of Contents

This document was automatically generated on Mon May 20 01:11:18 2019 by HappyDoc version 2.1