9 lines
246 B
Python
9 lines
246 B
Python
|
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)
|