Class: Playwright::EventEmitterProxy

Inherits:
Object
  • Object
show all
Includes:
EventEmitter
Defined in:
lib/playwright/event_emitter_proxy.rb

Instance Method Summary collapse

Methods included from EventEmitter

#emit

Constructor Details

#initialize(api, impl) ⇒ EventEmitterProxy

Returns a new instance of EventEmitterProxy.

Parameters:



7
8
9
10
11
# File 'lib/playwright/event_emitter_proxy.rb', line 7

def initialize(api, impl)
  @api = api
  @impl = impl
  @listeners = {}
end

Instance Method Details

#off(event, callback) ⇒ Object



27
28
29
30
31
32
# File 'lib/playwright/event_emitter_proxy.rb', line 27

def off(event, callback)
  super
  if listener_count(event) == 0
    unsubscribe(event)
  end
end

#on(event, callback) ⇒ Object



13
14
15
16
17
18
# File 'lib/playwright/event_emitter_proxy.rb', line 13

def on(event, callback)
  if listener_count(event) == 0
    subscribe(event)
  end
  super
end

#once(event, callback) ⇒ Object



20
21
22
23
24
25
# File 'lib/playwright/event_emitter_proxy.rb', line 20

def once(event, callback)
  if listener_count(event) == 0
    subscribe(event)
  end
  super
end