Class: ApiMaker::ResetIndexedDbService
- Inherits:
-
ApplicationService
- Object
- ServicePattern::Service
- ApplicationService
- ApiMaker::ResetIndexedDbService
- Defined in:
- app/services/api_maker/reset_indexed_db_service.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
Instance Method Summary collapse
-
#initialize(context:) ⇒ ResetIndexedDbService
constructor
A new instance of ResetIndexedDbService.
- #perform ⇒ Object
- #reset_indexed_db ⇒ Object
Methods inherited from ApplicationService
Constructor Details
#initialize(context:) ⇒ ResetIndexedDbService
Returns a new instance of ResetIndexedDbService.
6 7 8 |
# File 'app/services/api_maker/reset_indexed_db_service.rb', line 6 def initialize(context:) @context = context end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
2 3 4 |
# File 'app/services/api_maker/reset_indexed_db_service.rb', line 2 def context @context end |
Instance Method Details
#perform ⇒ Object
10 11 12 13 14 15 |
# File 'app/services/api_maker/reset_indexed_db_service.rb', line 10 def perform # Firefox doesnt support 'indexedDB.databases()' reset_indexed_db unless browser_firefox? succeed! end |
#reset_indexed_db ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/services/api_maker/reset_indexed_db_service.rb', line 17 def reset_indexed_db execute_script " indexedDB.databases().then(function(databases) { var promises = [] for(var database of databases) { promises.push(indexedDB.deleteDatabase(database.name)) } Promise.all(promises).then(function() { console.error('All databases were deleted') }) }) " WaitUtil.wait_for_condition("databases to be deleted", delay_sec: 0.2, timeout_sec: 6) do logs_text = browser_logs.map(&:message).join("\n") logs_text.include?("\"All databases were deleted\"") end end |