Class: WebviewContainedService
- Inherits:
-
Shoes::Linkable
- Object
- Shoes::Linkable
- WebviewContainedService
- Includes:
- Scarpe::Log, Scarpe::WVRelayUtil
- Defined in:
- lib/scarpe/wv/wv_display_worker.rb
Constant Summary
Constants included from Scarpe::Log
Scarpe::Log::DEFAULT_DEBUG_LOG_CONFIG, Scarpe::Log::DEFAULT_LOG_CONFIG
Instance Attribute Summary collapse
-
#log ⇒ Object
readonly
Returns the value of attribute log.
Attributes inherited from Shoes::Linkable
Instance Method Summary collapse
-
#initialize(from, to) ⇒ WebviewContainedService
constructor
A new instance of WebviewContainedService.
Methods included from Scarpe::WVRelayUtil
#event_loop_for, #ready_to_read?, #receive_datagram, #respond_to_datagram, #send_datagram
Methods included from Scarpe::Log
Methods inherited from Shoes::Linkable
#bind_shoes_event, #send_self_event, #send_shoes_event, #unsub_shoes_event
Constructor Details
#initialize(from, to) ⇒ WebviewContainedService
Returns a new instance of WebviewContainedService.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/scarpe/wv/wv_display_worker.rb', line 26 def initialize(from, to) super() log_init("WV::DisplayWorker") @i_am = :child @event_subs = [] @wv_display = Scarpe::WebviewDisplayService.new @from = from @to = to @init_done = false # Wait to register our periodic_code until the wrangler exists @event_subs << bind_shoes_event(event_name: "init") do @wv_display.wrangler.periodic_code("datagramProcessor", 0.1) do respond_to_datagram while ready_to_read?(0.0) end @init_done = true end # Subscribe to all event notifications and relay them to the opposite side @event_subs << bind_shoes_event(event_name: :any, target: :any) do |*args, **kwargs| unless kwargs[:relayed] || kwargs["relayed"] kwargs[:relayed] = true send_datagram({ type: :event, args:, kwargs: }) end end # Run for 2.5 seconds to let the app be created and "run" to get called. # Once that happens, Webview will take over the event loop. event_loop_for(2.5) end |
Instance Attribute Details
#log ⇒ Object (readonly)
Returns the value of attribute log.
24 25 26 |
# File 'lib/scarpe/wv/wv_display_worker.rb', line 24 def log @log end |