Skip to content

Commit

Permalink
Added stream activate and deactivate methods
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Oct 14, 2016
1 parent 82de0a7 commit acee5d2
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions holoviews/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit acee5d2

Please sign in to comment.