diff --git a/lib/tfw/mixins/callback_mixin.py b/lib/tfw/mixins/callback_mixin.py index 3c94e71..54515f3 100644 --- a/lib/tfw/mixins/callback_mixin.py +++ b/lib/tfw/mixins/callback_mixin.py @@ -21,6 +21,14 @@ class CallbackMixin: fun = partial(callback, *args, **kwargs) self._callbacks.append(fun) + def subscribe_callbacks(self, *callbacks): + """ + Subscribe a list of callbacks to incoke once an event is triggered. + :param callbacks: callbacks to be subscribed + """ + for callback in callbacks: + self.subscribe_callback(callback) + def unsubscribe_callback(self, callback): self._callbacks.remove(callback)