Class: Ruflet::UI::Services::RufletServicesComponents::ShakeDetectorControl

Inherits:
Control
  • Object
show all
Defined in:
lib/ruflet_ui/ruflet/ui/services/ruflet/shakedetector_control.rb

Constant Summary collapse

TYPE =
"shakedetector".freeze
WIRE =
"ShakeDetector".freeze

Constants inherited from Control

Control::HOST_EXPANDED_TYPES

Instance Attribute Summary

Attributes inherited from Control

#children, #id, #props, #runtime_page, #type, #wire_id

Instance Method Summary collapse

Methods inherited from Control

#emit, generate_id, #has_handler?, #on, #to_patch

Constructor Details

#initialize(id: nil, data: nil, key: nil, minimum_shake_count: nil, shake_count_reset_time_ms: nil, shake_slop_time_ms: nil, shake_threshold_gravity: nil, on_shake: nil) ⇒ ShakeDetectorControl

Returns a new instance of ShakeDetectorControl.



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/ruflet_ui/ruflet/ui/services/ruflet/shakedetector_control.rb', line 11

def initialize(id: nil, data: nil, key: nil, minimum_shake_count: nil, shake_count_reset_time_ms: nil, shake_slop_time_ms: nil, shake_threshold_gravity: nil, on_shake: nil)
  props = {}
  props[:data] = data unless data.nil?
  props[:key] = key unless key.nil?
  props[:minimum_shake_count] = minimum_shake_count unless minimum_shake_count.nil?
  props[:shake_count_reset_time_ms] = shake_count_reset_time_ms unless shake_count_reset_time_ms.nil?
  props[:shake_slop_time_ms] = shake_slop_time_ms unless shake_slop_time_ms.nil?
  props[:shake_threshold_gravity] = shake_threshold_gravity unless shake_threshold_gravity.nil?
  props[:on_shake] = on_shake unless on_shake.nil?
  super(type: TYPE, id: id, **props)
end