eventbreakpoints.go 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. // Package eventbreakpoints provides the Chrome DevTools Protocol
  2. // commands, types, and events for the EventBreakpoints domain.
  3. //
  4. // EventBreakpoints permits setting JavaScript breakpoints on operations and
  5. // events occurring in native code invoked from JavaScript. Once breakpoint is
  6. // hit, it is reported through Debugger domain, similarly to regular breakpoints
  7. // being hit.
  8. //
  9. // Generated by the cdproto-gen command.
  10. package eventbreakpoints
  11. // Code generated by cdproto-gen. DO NOT EDIT.
  12. import (
  13. "context"
  14. "github.com/chromedp/cdproto/cdp"
  15. )
  16. // SetInstrumentationBreakpointParams sets breakpoint on particular native
  17. // event.
  18. type SetInstrumentationBreakpointParams struct {
  19. EventName string `json:"eventName"` // Instrumentation name to stop on.
  20. }
  21. // SetInstrumentationBreakpoint sets breakpoint on particular native event.
  22. //
  23. // See: https://chromedevtools.github.io/devtools-protocol/tot/EventBreakpoints#method-setInstrumentationBreakpoint
  24. //
  25. // parameters:
  26. //
  27. // eventName - Instrumentation name to stop on.
  28. func SetInstrumentationBreakpoint(eventName string) *SetInstrumentationBreakpointParams {
  29. return &SetInstrumentationBreakpointParams{
  30. EventName: eventName,
  31. }
  32. }
  33. // Do executes EventBreakpoints.setInstrumentationBreakpoint against the provided context.
  34. func (p *SetInstrumentationBreakpointParams) Do(ctx context.Context) (err error) {
  35. return cdp.Execute(ctx, CommandSetInstrumentationBreakpoint, p, nil)
  36. }
  37. // RemoveInstrumentationBreakpointParams removes breakpoint on particular
  38. // native event.
  39. type RemoveInstrumentationBreakpointParams struct {
  40. EventName string `json:"eventName"` // Instrumentation name to stop on.
  41. }
  42. // RemoveInstrumentationBreakpoint removes breakpoint on particular native
  43. // event.
  44. //
  45. // See: https://chromedevtools.github.io/devtools-protocol/tot/EventBreakpoints#method-removeInstrumentationBreakpoint
  46. //
  47. // parameters:
  48. //
  49. // eventName - Instrumentation name to stop on.
  50. func RemoveInstrumentationBreakpoint(eventName string) *RemoveInstrumentationBreakpointParams {
  51. return &RemoveInstrumentationBreakpointParams{
  52. EventName: eventName,
  53. }
  54. }
  55. // Do executes EventBreakpoints.removeInstrumentationBreakpoint against the provided context.
  56. func (p *RemoveInstrumentationBreakpointParams) Do(ctx context.Context) (err error) {
  57. return cdp.Execute(ctx, CommandRemoveInstrumentationBreakpoint, p, nil)
  58. }
  59. // DisableParams removes all breakpoints.
  60. type DisableParams struct{}
  61. // Disable removes all breakpoints.
  62. //
  63. // See: https://chromedevtools.github.io/devtools-protocol/tot/EventBreakpoints#method-disable
  64. func Disable() *DisableParams {
  65. return &DisableParams{}
  66. }
  67. // Do executes EventBreakpoints.disable against the provided context.
  68. func (p *DisableParams) Do(ctx context.Context) (err error) {
  69. return cdp.Execute(ctx, CommandDisable, nil, nil)
  70. }
  71. // Command names.
  72. const (
  73. CommandSetInstrumentationBreakpoint = "EventBreakpoints.setInstrumentationBreakpoint"
  74. CommandRemoveInstrumentationBreakpoint = "EventBreakpoints.removeInstrumentationBreakpoint"
  75. CommandDisable = "EventBreakpoints.disable"
  76. )