chromedp/cdp/inspector/inspector.go
2017-01-26 14:28:34 +07:00

93 lines
1.7 KiB
Go

// Package inspector provides the Chrome Debugging Protocol
// commands, types, and events for the Chrome 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.
func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (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 cdp.ErrContextDone
}
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.
func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (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 cdp.ErrContextDone
}
return cdp.ErrUnknownResult
}