Class: Ruflet::UI::Services::RufletServicesComponents::GeolocatorControl
- Inherits:
-
Control
- Object
- Control
- Ruflet::UI::Services::RufletServicesComponents::GeolocatorControl
- Defined in:
- lib/ruflet_ui/ruflet/ui/services/ruflet/geolocator_control.rb
Constant Summary collapse
- TYPE =
"geolocator".freeze
- WIRE =
"Geolocator".freeze
Constants inherited from Control
Instance Attribute Summary
Attributes inherited from Control
#children, #id, #props, #runtime_page, #type, #wire_id
Instance Method Summary collapse
- #distance_between(start_latitude, start_longitude, end_latitude, end_longitude, timeout: 10, on_result: nil) ⇒ Object
- #get_current_position(configuration: nil, timeout: 10, on_result: nil) ⇒ Object
-
#initialize(id: nil, configuration: nil, data: nil, key: nil, on_error: nil, on_position_change: nil) ⇒ GeolocatorControl
constructor
A new instance of GeolocatorControl.
Methods inherited from Control
#emit, generate_id, #has_handler?, #on, #to_patch
Constructor Details
#initialize(id: nil, configuration: nil, data: nil, key: nil, on_error: nil, on_position_change: nil) ⇒ GeolocatorControl
Returns a new instance of GeolocatorControl.
11 12 13 14 15 16 17 18 19 |
# File 'lib/ruflet_ui/ruflet/ui/services/ruflet/geolocator_control.rb', line 11 def initialize(id: nil, configuration: nil, data: nil, key: nil, on_error: nil, on_position_change: nil) props = {} props[:configuration] = configuration unless configuration.nil? props[:data] = data unless data.nil? props[:key] = key unless key.nil? props[:on_error] = on_error unless on_error.nil? props[:on_position_change] = on_position_change unless on_position_change.nil? super(type: TYPE, id: id, **props) end |
Instance Method Details
#distance_between(start_latitude, start_longitude, end_latitude, end_longitude, timeout: 10, on_result: nil) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/ruflet_ui/ruflet/ui/services/ruflet/geolocator_control.rb', line 34 def distance_between(start_latitude, start_longitude, end_latitude, end_longitude, timeout: 10, on_result: nil) invoke_geolocator( "distance_between", args: { "start_latitude" => start_latitude, "start_longitude" => start_longitude, "end_latitude" => end_latitude, "end_longitude" => end_longitude }, timeout: timeout, on_result: on_result ) end |
#get_current_position(configuration: nil, timeout: 10, on_result: nil) ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/ruflet_ui/ruflet/ui/services/ruflet/geolocator_control.rb', line 48 def get_current_position(configuration: nil, timeout: 10, on_result: nil) invoke_geolocator( "get_current_position", args: compact_args("configuration" => configuration), timeout: timeout, on_result: on_result ) end |