aboutsummaryrefslogtreecommitdiff
path: root/mixins.go
diff options
context:
space:
mode:
Diffstat (limited to 'mixins.go')
-rwxr-xr-xmixins.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/mixins.go b/mixins.go
index 6688f36..1344d07 100755
--- a/mixins.go
+++ b/mixins.go
@@ -58,3 +58,17 @@ func WithErrChan() *MixinErrChan {
func (o MixinErrChan) apply(r *Rutina) {
r.errCh = make(chan error, 1)
}
+
+type LifecycleListener func(event Event, routineID int)
+
+type LifecycleMixin struct {
+ Listener LifecycleListener
+}
+
+func (l LifecycleMixin) apply(r *Rutina) {
+ r.lifecycleListener = l.Listener
+}
+
+func WithLifecycleListener(listener LifecycleListener) *LifecycleMixin {
+ return &LifecycleMixin{Listener: listener}
+}