diff options
author | Alexander Kiryukhin <a.kiryukhin@mail.ru> | 2019-06-15 10:20:37 +0300 |
---|---|---|
committer | Alexander Kiryukhin <a.kiryukhin@mail.ru> | 2019-06-15 10:20:37 +0300 |
commit | 741cf397a9150a8f76b8f74289b1dde8aaa43d02 (patch) | |
tree | 66a64d97e247b57b37d82493eb307d1bf64c7490 /mixins.go | |
parent | c691d422395cb72283512d8956a255db10b70b44 (diff) |
WIP: Added lifecycle mixin
Removed hooks
Diffstat (limited to 'mixins.go')
-rwxr-xr-x | mixins.go | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -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} +} |