Class: Selenium::DevTools::V151::WebAudio

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/devtools/v151/web_audio.rb

Constant Summary collapse

EVENTS =
{
  context_created: 'contextCreated',
  context_will_be_destroyed: 'contextWillBeDestroyed',
  context_changed: 'contextChanged',
  audio_listener_created: 'audioListenerCreated',
  audio_listener_will_be_destroyed: 'audioListenerWillBeDestroyed',
  audio_node_created: 'audioNodeCreated',
  audio_node_will_be_destroyed: 'audioNodeWillBeDestroyed',
  audio_param_created: 'audioParamCreated',
  audio_param_will_be_destroyed: 'audioParamWillBeDestroyed',
  nodes_connected: 'nodesConnected',
  nodes_disconnected: 'nodesDisconnected',
  node_param_connected: 'nodeParamConnected',
  node_param_disconnected: 'nodeParamDisconnected',
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(devtools) ⇒ WebAudio

Returns a new instance of WebAudio.



42
43
44
# File 'lib/selenium/devtools/v151/web_audio.rb', line 42

def initialize(devtools)
  @devtools = devtools
end

Instance Method Details

#disableObject



55
56
57
# File 'lib/selenium/devtools/v151/web_audio.rb', line 55

def disable
  @devtools.send_cmd('WebAudio.disable')
end

#enableObject



51
52
53
# File 'lib/selenium/devtools/v151/web_audio.rb', line 51

def enable
  @devtools.send_cmd('WebAudio.enable')
end

#get_realtime_data(context_id:) ⇒ Object



59
60
61
62
# File 'lib/selenium/devtools/v151/web_audio.rb', line 59

def get_realtime_data(context_id:)
  @devtools.send_cmd('WebAudio.getRealtimeData',
                     contextId: context_id)
end

#on(event, &block) ⇒ Object



46
47
48
49
# File 'lib/selenium/devtools/v151/web_audio.rb', line 46

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