mirror of
https://github.com/MontFerret/ferret.git
synced 2025-02-09 13:38:35 +02:00
Minor clean up
This commit is contained in:
parent
a3d3fe727d
commit
2ff668e643
26
main.go
26
main.go
@ -53,18 +53,6 @@ func (p *Params) ToMap() (map[string]interface{}, error) {
|
||||
}
|
||||
|
||||
var (
|
||||
help = flag.Bool(
|
||||
"help",
|
||||
false,
|
||||
"show this list",
|
||||
)
|
||||
|
||||
version = flag.Bool(
|
||||
"version",
|
||||
false,
|
||||
"show REPL version",
|
||||
)
|
||||
|
||||
conn = flag.String(
|
||||
"cdp",
|
||||
"http://0.0.0.0:9222",
|
||||
@ -80,7 +68,7 @@ var (
|
||||
proxyAddress = flag.String(
|
||||
"proxy",
|
||||
"",
|
||||
"address of proxy server to use (only applicable for static pages)",
|
||||
"address of proxy server to use (only applicable to static pages, proxy for dynamic pages controlled by Chrome)",
|
||||
)
|
||||
|
||||
userAgent = flag.String(
|
||||
@ -88,6 +76,18 @@ var (
|
||||
"",
|
||||
"set custom user agent. '*' triggers UA generation",
|
||||
)
|
||||
|
||||
version = flag.Bool(
|
||||
"version",
|
||||
false,
|
||||
"show REPL version",
|
||||
)
|
||||
|
||||
help = flag.Bool(
|
||||
"help",
|
||||
false,
|
||||
"show this list",
|
||||
)
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
@ -120,8 +120,8 @@ func NewHTMLDocument(
|
||||
doc.url = values.NewString(*root.BaseURL)
|
||||
}
|
||||
|
||||
broker.AddEventListener("load", doc.onLoad)
|
||||
broker.AddEventListener("error", doc.onError)
|
||||
broker.AddEventListener("load", doc.handlePageLoad)
|
||||
broker.AddEventListener("error", doc.handleError)
|
||||
|
||||
return doc
|
||||
}
|
||||
@ -748,7 +748,7 @@ func (doc *HTMLDocument) CaptureScreenshot(params *ScreenshotArgs) (core.Value,
|
||||
return values.NewBinary(reply.Data), nil
|
||||
}
|
||||
|
||||
func (doc *HTMLDocument) onLoad(_ interface{}) {
|
||||
func (doc *HTMLDocument) handlePageLoad(_ interface{}) {
|
||||
doc.Lock()
|
||||
defer doc.Unlock()
|
||||
|
||||
@ -782,7 +782,7 @@ func (doc *HTMLDocument) onLoad(_ interface{}) {
|
||||
}
|
||||
}
|
||||
|
||||
func (doc *HTMLDocument) onError(val interface{}) {
|
||||
func (doc *HTMLDocument) handleError(val interface{}) {
|
||||
err, ok := val.(error)
|
||||
|
||||
if !ok {
|
||||
|
Loading…
x
Reference in New Issue
Block a user