Class: Selenium::DevTools::V128::PerformanceTimeline

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/devtools/v128/performance_timeline.rb

Constant Summary collapse

EVENTS =
{
  timeline_event_added: 'timelineEventAdded',
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(devtools) ⇒ PerformanceTimeline

Returns a new instance of PerformanceTimeline.



29
30
31
# File 'lib/selenium/devtools/v128/performance_timeline.rb', line 29

def initialize(devtools)
  @devtools = devtools
end

Instance Method Details

#enable(event_types:) ⇒ Object



38
39
40
41
# File 'lib/selenium/devtools/v128/performance_timeline.rb', line 38

def enable(event_types:)
  @devtools.send_cmd('PerformanceTimeline.enable',
                     eventTypes: event_types)
end

#on(event, &block) ⇒ Object



33
34
35
36
# File 'lib/selenium/devtools/v128/performance_timeline.rb', line 33

def on(event, &block)
  event = EVENTS[event] if event.is_a?(Symbol)
  @devtools.callbacks["PerformanceTimeline.#{event}"] << block
end