From c691d422395cb72283512d8956a255db10b70b44 Mon Sep 17 00:00:00 2001 From: Alexander Kiryukhin Date: Thu, 4 Apr 2019 22:56:53 +0300 Subject: v0.4.3 Added: - Hooks for lifecycle events Fixed: - Close errors channel - Small fixes --- events.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 events.go (limited to 'events.go') diff --git a/events.go b/events.go new file mode 100644 index 0000000..d435e62 --- /dev/null +++ b/events.go @@ -0,0 +1,22 @@ +//go:generate stringer -type=Event +package rutina + +// Event represents lifecycle events +type Event int + +const ( + EventRoutineStart Event = iota + EventRoutineStop + EventRoutineComplete + EventRoutineFail + EventAppStop + EventAppComplete + EventAppFail +) + +// Hook is function that calls when event fired +// Params: +// ev Event - fired event +// r *Rutina - pointer to rutina +// rid int - ID of routine if present, 0 - otherwise +type Hook func(ev Event, r *Rutina, rid int) error -- cgit v1.2.3