Show More
@@ -17,7 +17,19 b' __docformat__ = "restructuredtext en"' | |||||
17 |
|
17 | |||
18 |
|
18 | |||
19 | class NotificationCenter(object): |
|
19 | class NotificationCenter(object): | |
20 |
"""Synchronous notification center |
|
20 | """Synchronous notification center | |
|
21 | ||||
|
22 | Example | |||
|
23 | ------- | |||
|
24 | >>> import IPython.kernel.core.notification as notification | |||
|
25 | >>> def callback(theType, theSender, args={}): | |||
|
26 | ... print theType,theSender,args | |||
|
27 | ... | |||
|
28 | >>> notification.sharedCenter.add_observer(callback, 'NOTIFICATION_TYPE', None) | |||
|
29 | >>> notification.sharedCenter.post_notification('NOTIFICATION_TYPE', object()) | |||
|
30 | NOTIFICATION_TYPE <object object at 0x284b0> {} | |||
|
31 | ||||
|
32 | """ | |||
21 | def __init__(self): |
|
33 | def __init__(self): | |
22 | super(NotificationCenter, self).__init__() |
|
34 | super(NotificationCenter, self).__init__() | |
23 | self._init_observers() |
|
35 | self._init_observers() |
General Comments 0
You need to be logged in to leave comments.
Login now