diff --git a/wtf/enablable.go b/wtf/enablable.go new file mode 100644 index 00000000..fc02ab88 --- /dev/null +++ b/wtf/enablable.go @@ -0,0 +1,9 @@ +package wtf + +// Enablable is the interface that enforces enable/disable capabilities on a module +type Enablable interface { + Disabled() bool + Enabled() bool + + Disable() +} diff --git a/wtf/enabler.go b/wtf/enabler.go deleted file mode 100644 index e72ca9df..00000000 --- a/wtf/enabler.go +++ /dev/null @@ -1,8 +0,0 @@ -package wtf - -type Enabler interface { - Disabled() bool - Enabled() bool - - Disable() -} diff --git a/wtf/scheduler.go b/wtf/schedulable.go similarity index 67% rename from wtf/scheduler.go rename to wtf/schedulable.go index 3cb0cecf..5ebd0fc4 100644 --- a/wtf/scheduler.go +++ b/wtf/schedulable.go @@ -4,14 +4,16 @@ import ( "time" ) -type Scheduler interface { +// Schedulable is the interface that enforces scheduling capabilities on a module +type Schedulable interface { Refresh() Refreshing() bool RefreshInterval() int } +// Schedule kicks off the first refresh of a module's data and then queues the rest of the +// data refreshes on a timer func Schedule(widget Wtfable) { - // Kick off the first refresh and then leave the rest to the timer widget.Refresh() interval := time.Duration(widget.RefreshInterval()) * time.Second diff --git a/wtf/wtfable.go b/wtf/wtfable.go index 3be156dd..d3aac524 100644 --- a/wtf/wtfable.go +++ b/wtf/wtfable.go @@ -6,9 +6,10 @@ import ( "github.com/rivo/tview" ) +// Wtfable is the interface that enforces WTF system capabilities on a module type Wtfable interface { - Enabler - Scheduler + Enablable + Schedulable BorderColor() string ConfigText() string