mtg/observable.py

9 lines
246 B
Python
Raw Normal View History

2010-06-16 14:16:49 +00:00
class Observable(object):
def __init__(self):
self.subscribers = []
def subscribe(self, subscriber):
self.subscribers.append(subscriber)
def emit(self, *args):
for fn in self.subscribers:
fn(*args)