Class: Playwright::EventEmitterProxy
- Inherits:
-
Object
- Object
- Playwright::EventEmitterProxy
- Includes:
- EventEmitter
- Defined in:
- lib/playwright/event_emitter_proxy.rb
Instance Method Summary collapse
-
#initialize(api, impl) ⇒ EventEmitterProxy
constructor
A new instance of EventEmitterProxy.
- #off(event, callback) ⇒ Object
- #on(event, callback) ⇒ Object
- #once(event, callback) ⇒ Object
Methods included from EventEmitter
Constructor Details
#initialize(api, impl) ⇒ EventEmitterProxy
Returns a new instance of EventEmitterProxy.
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 |