Class: Dommy::BatteryManager
- Inherits:
-
Object
- Object
- Dommy::BatteryManager
- Includes:
- EventTarget
- Defined in:
- lib/dommy/navigator.rb
Overview
navigator.getBattery() returns one of these. Fixed snapshot —
tests that need different values can stub.
Instance Attribute Summary collapse
-
#charging ⇒ Object
readonly
Returns the value of attribute charging.
-
#charging_time ⇒ Object
readonly
Returns the value of attribute charging_time.
-
#discharging_time ⇒ Object
readonly
Returns the value of attribute discharging_time.
-
#level ⇒ Object
readonly
Returns the value of attribute level.
Instance Method Summary collapse
- #__internal_event_parent__ ⇒ Object
- #__js_get__(key) ⇒ Object
-
#initialize(charging: true, level: 1.0, charging_time: 0, discharging_time: Float::INFINITY) ⇒ BatteryManager
constructor
A new instance of BatteryManager.
Methods included from EventTarget
#__dommy_dump_event_failure__, #__internal_deliver_event__, #__internal_process_event_handler_return__, #add_event_listener, capture_flag, #deliver_at, #dispatch_event, #event_name_from_on, #invoke_listener_isolated, js_truthy?, #on_handler, #remove_event_listener, #set_on_handler
Constructor Details
#initialize(charging: true, level: 1.0, charging_time: 0, discharging_time: Float::INFINITY) ⇒ BatteryManager
Returns a new instance of BatteryManager.
539 540 541 542 543 544 |
# File 'lib/dommy/navigator.rb', line 539 def initialize(charging: true, level: 1.0, charging_time: 0, discharging_time: Float::INFINITY) @charging = charging @level = level @charging_time = charging_time @discharging_time = discharging_time end |
Instance Attribute Details
#charging ⇒ Object (readonly)
Returns the value of attribute charging.
537 538 539 |
# File 'lib/dommy/navigator.rb', line 537 def charging @charging end |
#charging_time ⇒ Object (readonly)
Returns the value of attribute charging_time.
537 538 539 |
# File 'lib/dommy/navigator.rb', line 537 def charging_time @charging_time end |
#discharging_time ⇒ Object (readonly)
Returns the value of attribute discharging_time.
537 538 539 |
# File 'lib/dommy/navigator.rb', line 537 def discharging_time @discharging_time end |
#level ⇒ Object (readonly)
Returns the value of attribute level.
537 538 539 |
# File 'lib/dommy/navigator.rb', line 537 def level @level end |
Instance Method Details
#__internal_event_parent__ ⇒ Object
561 562 563 |
# File 'lib/dommy/navigator.rb', line 561 def __internal_event_parent__ nil end |
#__js_get__(key) ⇒ Object
546 547 548 549 550 551 552 553 554 555 556 557 558 559 |
# File 'lib/dommy/navigator.rb', line 546 def __js_get__(key) case key when "charging" @charging when "chargingTime" @charging_time when "dischargingTime" @discharging_time when "level" @level else Bridge::ABSENT end end |