-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgadget.go
14 lines (13 loc) · 1.07 KB
/
gadget.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
package times
//Gadget is an interface for tools that uses time.
//Each Gadget has minimum unit as time.Unit, and It has times.Format to represent current times as string.
//Examples of Gadget can be clock, timer, stopwatch.
type Gadget interface {
Add(action Action) //Add adds function that would be called when duration of minimum unit has passed. Parameter current in function is string-conversion of current time that inner function can uses.
AddAlarm(action Action, when Object) //AddAlarm adds function that would be called when Gadget reaches in selected time. Parameter current in function is string-conversion of current time that inner function can uses.
Start() //Start runs Gadget.
Stop() Object //Stop calls Pause and Reset. It also returns string as current.
Reset() //Reset sets Gadget to the state when it firstly initialized.
Pause() //Pause stops ticker.
Format(Object) string //Format returns inner format of the Gadget.
}