Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

62 lines (31 sloc) 1.66 KB

Events ()

An event emitter, in the style of Node.JS. ( event, listener )

Add the callable listenter to the list of listeners that will be called when event is emitted. ( event, listener )

Call listener exactly once, the next time that event is emitted. ( event, listener )

Remove the callable listener from the list of those that will be called when event is emitted. ( event, ... )

Remove all listeners for event. Additional _event_s can be passed as following arguments. ( event )

Return the list of callables listening for event. ( event, arg, ... )

Emit event with one or more _arg_s. ( sink )

Given an object sink, call its method (if present) that corresponds to an events name if and only if there are no listeners for that event.

Decorator ( EventEmitter, event )

A decorator to nominate functions as event listeners. Its first argument is the EventEmitter to attach to, and the second argument is the event to listen for.

For example:

@on(my_event_emitter, 'blow_up')
def push_red_button(thing):

If the event is omitted, the name of the function is used to determine the event. For example, this is equivalent to the code above:

def blow_up(thing):
Jump to Line
Something went wrong with that request. Please try again.