Class: Browser::Navigator::Position

Inherits:
Object
  • Object
show all
Includes:
Browser::NativeCachedWrapper
Defined in:
opal/browser/navigator.rb

Overview

Representation of user location based on Geolocation API

Example usage:

$window.navigator.geolocate.then do |pos|
  puts "#{pos.coords.latitude}, #{pos.coords.longitude}, #{pos.coords.accuracy}"
end

Defined Under Namespace

Classes: Coords

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Browser::NativeCachedWrapper

#restricted?, #set_native_reference

Instance Attribute Details

#timestampObject (readonly)



198
# File 'opal/browser/navigator.rb', line 198

alias_native :timestamp

Instance Method Details

#coordsObject



200
201
202
# File 'opal/browser/navigator.rb', line 200

def coords
  @coords ||= Coords.new(`#@native.coords`)
end