diff --git a/holoviews/streams.py b/holoviews/streams.py index 5a6f0c9cce..c6bd3dd11e 100644 --- a/holoviews/streams.py +++ b/holoviews/streams.py @@ -106,6 +106,9 @@ def trigger(cls, streams): for subscriber in subscribers: subscriber(**dict(union)) + for stream in streams: + stream.deactivate() + def __init__(self, preprocessors=[], source=None, subscribers=[], **params): """ @@ -125,6 +128,21 @@ def __init__(self, preprocessors=[], source=None, subscribers=[], **params): if source: self.registry[id(source)].append(self) + + def activate(self): + """ + Allows defining an action before the stream is updated. + """ + pass + + + def deactivate(self): + """ + Allows defining an action after the stream has been triggered. + """ + pass + + @property def source(self): return self._source @@ -153,6 +171,7 @@ def update(self, trigger=True, **kwargs): If trigger is enabled, the trigger classmethod is invoked on this particular Stream instance. """ + self.activate() params = self.params().values() constants = [p.constant for p in params] for param in params: