Class: Selenium::DevTools::V131::ServiceWorker
- Inherits:
-
Object
- Object
- Selenium::DevTools::V131::ServiceWorker
- Defined in:
- lib/selenium/devtools/v131/service_worker.rb
Constant Summary collapse
- EVENTS =
{ worker_error_reported: 'workerErrorReported', worker_registration_updated: 'workerRegistrationUpdated', worker_version_updated: 'workerVersionUpdated', }.freeze
Instance Method Summary collapse
- #deliver_push_message(origin:, registration_id:, data:) ⇒ Object
- #disable ⇒ Object
- #dispatch_periodic_sync_event(origin:, registration_id:, tag:) ⇒ Object
- #dispatch_sync_event(origin:, registration_id:, tag:, last_chance:) ⇒ Object
- #enable ⇒ Object
-
#initialize(devtools) ⇒ ServiceWorker
constructor
A new instance of ServiceWorker.
- #inspect_worker(version_id:) ⇒ Object
- #on(event, &block) ⇒ Object
- #set_force_update_on_page_load(force_update_on_page_load:) ⇒ Object
- #skip_waiting(scope_url:) ⇒ Object
- #start_worker(scope_url:) ⇒ Object
- #stop_all_workers ⇒ Object
- #stop_worker(version_id:) ⇒ Object
- #unregister(scope_url:) ⇒ Object
- #update_registration(scope_url:) ⇒ Object
Constructor Details
#initialize(devtools) ⇒ ServiceWorker
Returns a new instance of ServiceWorker.
31 32 33 |
# File 'lib/selenium/devtools/v131/service_worker.rb', line 31 def initialize(devtools) @devtools = devtools end |
Instance Method Details
#deliver_push_message(origin:, registration_id:, data:) ⇒ Object
40 41 42 43 44 45 |
# File 'lib/selenium/devtools/v131/service_worker.rb', line 40 def (origin:, registration_id:, data:) @devtools.send_cmd('ServiceWorker.deliverPushMessage', origin: origin, registrationId: registration_id, data: data) end |
#disable ⇒ Object
47 48 49 |
# File 'lib/selenium/devtools/v131/service_worker.rb', line 47 def disable @devtools.send_cmd('ServiceWorker.disable') end |
#dispatch_periodic_sync_event(origin:, registration_id:, tag:) ⇒ Object
59 60 61 62 63 64 |
# File 'lib/selenium/devtools/v131/service_worker.rb', line 59 def dispatch_periodic_sync_event(origin:, registration_id:, tag:) @devtools.send_cmd('ServiceWorker.dispatchPeriodicSyncEvent', origin: origin, registrationId: registration_id, tag: tag) end |
#dispatch_sync_event(origin:, registration_id:, tag:, last_chance:) ⇒ Object
51 52 53 54 55 56 57 |
# File 'lib/selenium/devtools/v131/service_worker.rb', line 51 def dispatch_sync_event(origin:, registration_id:, tag:, last_chance:) @devtools.send_cmd('ServiceWorker.dispatchSyncEvent', origin: origin, registrationId: registration_id, tag: tag, lastChance: last_chance) end |
#enable ⇒ Object
66 67 68 |
# File 'lib/selenium/devtools/v131/service_worker.rb', line 66 def enable @devtools.send_cmd('ServiceWorker.enable') end |
#inspect_worker(version_id:) ⇒ Object
70 71 72 73 |
# File 'lib/selenium/devtools/v131/service_worker.rb', line 70 def inspect_worker(version_id:) @devtools.send_cmd('ServiceWorker.inspectWorker', versionId: version_id) end |
#on(event, &block) ⇒ Object
35 36 37 38 |
# File 'lib/selenium/devtools/v131/service_worker.rb', line 35 def on(event, &block) event = EVENTS[event] if event.is_a?(Symbol) @devtools.callbacks["ServiceWorker.#{event}"] << block end |
#set_force_update_on_page_load(force_update_on_page_load:) ⇒ Object
75 76 77 78 |
# File 'lib/selenium/devtools/v131/service_worker.rb', line 75 def set_force_update_on_page_load(force_update_on_page_load:) @devtools.send_cmd('ServiceWorker.setForceUpdateOnPageLoad', forceUpdateOnPageLoad: force_update_on_page_load) end |
#skip_waiting(scope_url:) ⇒ Object
80 81 82 83 |
# File 'lib/selenium/devtools/v131/service_worker.rb', line 80 def skip_waiting(scope_url:) @devtools.send_cmd('ServiceWorker.skipWaiting', scopeURL: scope_url) end |
#start_worker(scope_url:) ⇒ Object
85 86 87 88 |
# File 'lib/selenium/devtools/v131/service_worker.rb', line 85 def start_worker(scope_url:) @devtools.send_cmd('ServiceWorker.startWorker', scopeURL: scope_url) end |
#stop_all_workers ⇒ Object
90 91 92 |
# File 'lib/selenium/devtools/v131/service_worker.rb', line 90 def stop_all_workers @devtools.send_cmd('ServiceWorker.stopAllWorkers') end |
#stop_worker(version_id:) ⇒ Object
94 95 96 97 |
# File 'lib/selenium/devtools/v131/service_worker.rb', line 94 def stop_worker(version_id:) @devtools.send_cmd('ServiceWorker.stopWorker', versionId: version_id) end |
#unregister(scope_url:) ⇒ Object
99 100 101 102 |
# File 'lib/selenium/devtools/v131/service_worker.rb', line 99 def unregister(scope_url:) @devtools.send_cmd('ServiceWorker.unregister', scopeURL: scope_url) end |
#update_registration(scope_url:) ⇒ Object
104 105 106 107 |
# File 'lib/selenium/devtools/v131/service_worker.rb', line 104 def update_registration(scope_url:) @devtools.send_cmd('ServiceWorker.updateRegistration', scopeURL: scope_url) end |