mirror of
				https://github.com/MontFerret/ferret.git
				synced 2025-10-30 23:37:40 +02:00 
			
		
		
		
	Minor clean up
This commit is contained in:
		
							
								
								
									
										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 { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user