Table of Contents

Class: IEventSource ./src/peak/events/interfaces.py

Thing you can receive notifications from, as well as task-switch on

Note that every event source can control task switching, but not every task switcher is an event source. Generators, for example, can control task flow, but do not really produce any "events".

Event callbacks must not raise errors, as event sources are not required to ensure that all callbacks are executed when a callback raises an error.

Base Classes   
ITaskSwitch
    protocols.Interface
Methods   
addCallback
  addCallback 
addCallback ( func )

Call func(source,event) the next time this event occurs

Usage:: canceller = source.addCallback(somefunc)

If this method is called from within a callback, func must not be invoked until the next occurrence of the event.

Note also that callbacks will be called at most once for each time they are registered; adding a callback does not result in an ongoing "subscription" to the event source.

This method should return a canceller object that can be called to cancel the callback. Cancelling a callback that has already occurred or been cancelled is a no-op. (Note that even if the same func is passed to addCallback() more than once, each individual canceller must cancel that specific occurrence, and no other.)


Table of Contents

This document was automatically generated on Mon Mar 25 01:11:05 2024 by HappyDoc version 2.1