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)


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

alias_native :timestamp

Instance Method Details

#coordsObject


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

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