diff options
author | Eddy Pedroni <eddy@0xf7.com> | 2022-01-03 18:49:09 +0100 |
---|---|---|
committer | Eddy Pedroni <eddy@0xf7.com> | 2022-01-03 18:49:09 +0100 |
commit | 91cbf23d3acc3e44b333cac95d45575bc7bacb1c (patch) | |
tree | d6f336363ce050e3dfb54d2f1d01dbec136104c1 /notifier.py | |
parent | d9c8684447654f1b7b4b3b0f25a7a56d42a8f535 (diff) |
Added basic event notification capabilities, first event
Diffstat (limited to 'notifier.py')
-rw-r--r-- | notifier.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/notifier.py b/notifier.py new file mode 100644 index 0000000..1a68c56 --- /dev/null +++ b/notifier.py @@ -0,0 +1,15 @@ + +class Notifier: + PLAYING_STATE_EVENT = 0 + + def __init__(self): + self._callbacks = dict() + + def registerCallback(self, event, callback): + if event not in self._callbacks: + self._callbacks[event] = list() + self._callbacks[event].append(callback) + + def notify(self, event): + for callback in self._callbacks.get(event, list()): + callback() |