arcast/pkg/browser/browser.go

36 lines
678 B
Go
Raw Permalink Normal View History

2023-12-13 20:07:22 +01:00
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)
}