36 lines
678 B
Go
36 lines
678 B
Go
|
package browser
|
||
|
|
||
|
import "fmt"
|
||
|
|
||
|
type Status int
|
||
|
|
||
|
const (
|
||
|
StatusUnknown Status = iota
|
||
|
StatusIdle
|
||
|
StatusCasting
|
||
|
)
|
||
|
|
||
|
func (s Status) String() string {
|
||
|
switch s {
|
||
|
case StatusIdle:
|
||
|
return "idle"
|
||
|
case StatusCasting:
|
||
|
return "casting"
|
||
|
default:
|
||
|
return fmt.Sprintf("unknown (%d)", s)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
type Browser interface {
|
||
|
// Cast loads an URL
|
||
|
Load(url string) error
|
||
|
// Reset resets the browser to the given idle URL
|
||
|
Reset(url string) error
|
||
|
// Status returns the browser's current status
|
||
|
Status() (Status, error)
|
||
|
// Title returns the browser's currently loaded page title
|
||
|
Title() (string, error)
|
||
|
// URL returns the browser's currently loaded page URL
|
||
|
URL() (string, error)
|
||
|
}
|