mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Better naming for some of the core interfaces
This commit is contained in:
parent
7ddf4a566d
commit
e593a0d007
9
wtf/enablable.go
Normal file
9
wtf/enablable.go
Normal file
@ -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()
|
||||||
|
}
|
@ -1,8 +0,0 @@
|
|||||||
package wtf
|
|
||||||
|
|
||||||
type Enabler interface {
|
|
||||||
Disabled() bool
|
|
||||||
Enabled() bool
|
|
||||||
|
|
||||||
Disable()
|
|
||||||
}
|
|
@ -4,14 +4,16 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Scheduler interface {
|
// Schedulable is the interface that enforces scheduling capabilities on a module
|
||||||
|
type Schedulable interface {
|
||||||
Refresh()
|
Refresh()
|
||||||
Refreshing() bool
|
Refreshing() bool
|
||||||
RefreshInterval() int
|
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) {
|
func Schedule(widget Wtfable) {
|
||||||
// Kick off the first refresh and then leave the rest to the timer
|
|
||||||
widget.Refresh()
|
widget.Refresh()
|
||||||
|
|
||||||
interval := time.Duration(widget.RefreshInterval()) * time.Second
|
interval := time.Duration(widget.RefreshInterval()) * time.Second
|
@ -6,9 +6,10 @@ import (
|
|||||||
"github.com/rivo/tview"
|
"github.com/rivo/tview"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Wtfable is the interface that enforces WTF system capabilities on a module
|
||||||
type Wtfable interface {
|
type Wtfable interface {
|
||||||
Enabler
|
Enablable
|
||||||
Scheduler
|
Schedulable
|
||||||
|
|
||||||
BorderColor() string
|
BorderColor() string
|
||||||
ConfigText() string
|
ConfigText() string
|
||||||
|
Loading…
x
Reference in New Issue
Block a user