chromedp/cdp/inspector/inspector.go

95 lines
1.8 KiB
Go

// Package inspector provides the Chrome Debugging Protocol
// commands, types, and events for the Inspector domain.
//
// Generated by the chromedp-gen command.
package inspector
// AUTOGENERATED. DO NOT EDIT.
import (
"context"
cdp "github.com/knq/chromedp/cdp"
"github.com/mailru/easyjson"
)
// EnableParams enables inspector domain notifications.
type EnableParams struct{}
// Enable enables inspector domain notifications.
func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes Inspector.enable against the provided context and
// target handler.
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
// execute
ch := h.Execute(ctxt, cdp.CommandInspectorEnable, cdp.Empty)
// read response
select {
case res := <-ch:
if res == nil {
return cdp.ErrChannelClosed
}
switch v := res.(type) {
case easyjson.RawMessage:
return nil
case error:
return v
}
case <-ctxt.Done():
return ctxt.Err()
}
return cdp.ErrUnknownResult
}
// DisableParams disables inspector domain notifications.
type DisableParams struct{}
// Disable disables inspector domain notifications.
func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes Inspector.disable against the provided context and
// target handler.
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
// execute
ch := h.Execute(ctxt, cdp.CommandInspectorDisable, cdp.Empty)
// read response
select {
case res := <-ch:
if res == nil {
return cdp.ErrChannelClosed
}
switch v := res.(type) {
case easyjson.RawMessage:
return nil
case error:
return v
}
case <-ctxt.Done():
return ctxt.Err()
}
return cdp.ErrUnknownResult
}