Class: Dommy::WakeLock
- Inherits:
-
Object
- Object
- Dommy::WakeLock
- Includes:
- Bridge::Methods
- Defined in:
- lib/dommy/navigator.rb
Overview
navigator.wakeLock — Screen Wake Lock API stub. request(type)
returns a Promise of a WakeLockSentinel whose release() flips
released and dispatches a release event.
Instance Method Summary collapse
- #__js_call__(method, args) ⇒ Object
-
#initialize(window) ⇒ WakeLock
constructor
A new instance of WakeLock.
- #request(type = "screen") ⇒ Object
Methods included from Bridge::Methods
Constructor Details
#initialize(window) ⇒ WakeLock
Returns a new instance of WakeLock.
466 467 468 |
# File 'lib/dommy/navigator.rb', line 466 def initialize(window) @window = window end |
Instance Method Details
#__js_call__(method, args) ⇒ Object
476 477 478 479 480 481 |
# File 'lib/dommy/navigator.rb', line 476 def __js_call__(method, args) case method when "request" request(args[0] || "screen") end end |
#request(type = "screen") ⇒ Object
470 471 472 |
# File 'lib/dommy/navigator.rb', line 470 def request(type = "screen") PromiseValue.resolve(@window, WakeLockSentinel.new(@window, type.to_s)) end |