Documentation
¶
Index ¶
- Constants
- Variables
- type Audit
- type AuditRef
- type Category
- type CategoryGroup
- type ConfigSettings
- type Distribution
- type Entity
- type Environment
- type LighthouseResult
- type LighthouseScores
- type LighthouseWorker
- func (w *LighthouseWorker) Close() error
- func (w *LighthouseWorker) Get() *LighthouseScores
- func (w *LighthouseWorker) NumTask() int
- func (w *LighthouseWorker) NumWorker() int
- func (w *LighthouseWorker) Put(u string)
- func (w *LighthouseWorker) StartWorker()
- func (w *LighthouseWorker) StartWorkers(n int)
- func (w *LighthouseWorker) StopWorker() bool
- type LoadingExperience
- type Metric
- type Options
- type Result
- type RuntimeError
- type Timing
Examples ¶
Constants ¶
View Source
const ( CategoryAccessibility = "ACCESSIBILITY" CategoryBestPractices = "BEST_PRACTICES" CategoryPerformance = "PERFORMANCE" CategorySEO = "SEO" CategoryPWA = "PWA" )
Possible values for category paramater
View Source
const ( StrategyDesktop = "dektop" StrategyMobile = "mobile" )
Possible values for strategy paramater
View Source
const (
ApiEndpoint = "https://www.googleapis.com/pagespeedonline/v5/runPagespeed"
)
Variables ¶
View Source
var ( // Shorthand to include every category CategoryAll = []string{CategoryAccessibility, CategoryBestPractices, CategoryPerformance, CategorySEO, CategoryPWA} )
Functions ¶
This section is empty.
Types ¶
type CategoryGroup ¶
type ConfigSettings ¶
type Distribution ¶
type Environment ¶
type LighthouseResult ¶
type LighthouseResult struct { RequestedUrl string `json:"requestedUrl"` FinalUrl string `json:"finalUrl"` MainDocumentUrl string `json:"mainDocumentUrl"` FinalDisplayedUrl string `json:"finalDisplayedUrl"` LighthouseVersion string `json:"lighthouseVersion"` UserAgent string `json:"userAgent"` FetchTime string `json:"fetchTime"` Environment Environment `json:"environment"` RunWarnings []string `json:"runWarnings"` ConfigSettings ConfigSettings `json:"configSettings"` Audits map[string]Audit `json:"audits"` Categories map[string]Category `json:"categories"` CategoryGroups map[string]CategoryGroup `json:"categoryGroups"` RuntimeError RuntimeError `json:"runtimeError"` Timing Timing `json:"timing"` Entities []Entity `json:"entities"` }
type LighthouseScores ¶ added in v0.2.0
type LighthouseScores struct { URL string `json:",omitempty" yaml:",omitempty"` Performance int `json:",omitempty" yaml:",omitempty"` Accessibility int `json:",omitempty" yaml:",omitempty"` BestPractices int `json:",omitempty" yaml:",omitempty"` SEO int `json:",omitempty" yaml:",omitempty"` PWA int `json:",omitempty" yaml:",omitempty"` Error error `json:",omitempty" yaml:",omitempty"` }
func RunLighthouse ¶ added in v0.3.0
func RunLighthouse(u string, opts *Options) (*LighthouseScores, error)
Example ¶
r, err := pagespeed.RunPagespeed(randomURL(), pagespeed.FullAnalysisWithKey(os.Getenv("GOOGLE_CLOUD_KEY"))) if err != nil { // handle error } fmt.Printf("%#v\n", r)
func (LighthouseScores) String ¶ added in v0.2.0
func (l LighthouseScores) String() string
func (*LighthouseScores) Total ¶ added in v0.3.0
func (l *LighthouseScores) Total() int
type LighthouseWorker ¶ added in v0.3.0
type LighthouseWorker struct {
// contains filtered or unexported fields
}
func NewLighthouseWorker ¶ added in v0.3.0
func NewLighthouseWorker(opt *Options, numWorker int, lenBuf int) *LighthouseWorker
func (*LighthouseWorker) Close ¶ added in v0.3.0
func (w *LighthouseWorker) Close() error
func (*LighthouseWorker) Get ¶ added in v0.3.0
func (w *LighthouseWorker) Get() *LighthouseScores
func (*LighthouseWorker) NumTask ¶ added in v0.3.0
func (w *LighthouseWorker) NumTask() int
func (*LighthouseWorker) NumWorker ¶ added in v0.3.0
func (w *LighthouseWorker) NumWorker() int
func (*LighthouseWorker) Put ¶ added in v0.3.0
func (w *LighthouseWorker) Put(u string)
func (*LighthouseWorker) StartWorker ¶ added in v0.3.0
func (w *LighthouseWorker) StartWorker()
func (*LighthouseWorker) StartWorkers ¶ added in v0.3.0
func (w *LighthouseWorker) StartWorkers(n int)
func (*LighthouseWorker) StopWorker ¶ added in v0.3.0
func (w *LighthouseWorker) StopWorker() bool
type LoadingExperience ¶
type Metric ¶
type Metric struct { Percentile int `json:"percentile"` Distributions []Distribution `json:"distributions"` Category string `json:"category"` }
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
func FullAnalysis ¶ added in v0.3.0
func FullAnalysis() *Options
func FullAnalysisWithKey ¶ added in v0.3.0
func NewOptions ¶ added in v0.3.0
func NewOptions() *Options
func (*Options) RequestURL ¶
RequestURL creates the request URL to analyze URL u.
func (*Options) SetCategories ¶ added in v0.3.0
type Result ¶
type Result struct { CaptchaResult string `json:"captchaResult"` Kind string `json:"kind"` ID string `json:"id"` LoadingExperience LoadingExperience `json:"loadingExperience"` OriginLoadingExperience LoadingExperience `json:"originLoadingExperience"` LighthouseResult LighthouseResult `json:"lighthouseResult"` AnalysisUTCTimestamp time.Time `json:"analysisUTCTimestamp"` }
func RunPagespeed ¶ added in v0.3.0
Example ¶
r, err := pagespeed.RunPagespeed(randomURL(), pagespeed.FullAnalysisWithKey(os.Getenv("GOOGLE_CLOUD_KEY"))) if err != nil { // handle error } fmt.Printf("%#v\n", r)
func (*Result) LighthouseScores ¶ added in v0.2.0
func (r *Result) LighthouseScores() *LighthouseScores
type RuntimeError ¶
func (RuntimeError) Error ¶ added in v0.3.0
func (r RuntimeError) Error() string
func (*RuntimeError) UnmarshalJSON ¶ added in v0.3.0
func (r *RuntimeError) UnmarshalJSON(data []byte) error
Click to show internal directories.
Click to hide internal directories.