Sha256: 6659c2b6cba3d8afc3085a4873bd2c694a130a250013b469cdab98cc96a4f4a1

Contents?: true

Size: 346 Bytes

Versions: 73

Compression:

Stored size: 346 Bytes

Contents

# frozen_string_literal: true

class Atome
  def geolocation
    localisation = {latitude: nil, longitude: nil}
    $window.navigator.geolocate.then do |pos|
      localisation[:latitude] =  pos.coords.latitude
      localisation[:longitude] =  pos.coords.longitude
    end.rescue do |err|
      p  err
      localisation = nil
    end
  end
end

Version data entries

73 entries across 73 versions & 1 rubygems

Version Path
atome-0.5.6.3.6 lib/platform_specific/opal/extensions/geolocation.rb
atome-0.5.6.3.5 lib/platform_specific/opal/extensions/geolocation.rb
atome-0.5.6.3.1 lib/platform_specific/opal/extensions/geolocation.rb
atome-0.5.6.3.0 lib/platform_specific/opal/extensions/geolocation.rb
atome-0.5.6.2.9 lib/platform_specific/opal/extensions/geolocation.rb
atome-0.5.6.2.7 lib/platform_specific/opal/extensions/geolocation.rb
atome-0.5.6.2.5 lib/platform_specific/opal/extensions/geolocation.rb
atome-0.5.6.2.4 lib/platform_specific/opal/extensions/geolocation.rb
atome-0.5.6.2.3 lib/platform_specific/opal/extensions/geolocation.rb
atome-0.5.6.2.1 lib/platform_specific/opal/extensions/geolocation.rb
atome-0.5.6.2.0 lib/platform_specific/opal/extensions/geolocation.rb
atome-0.5.6.1.9 lib/platform_specific/opal/extensions/geolocation.rb
atome-0.5.6.1.4 lib/platform_specific/opal/extensions/geolocation.rb
atome-0.5.6.1.1 lib/platform_specific/opal/extensions/geolocation.rb
atome-0.5.6.1.0 lib/platform_specific/opal/extensions/geolocation.rb
atome-0.5.6.0.4 lib/platform_specific/opal/extensions/geolocation.rb
atome-0.5.6.0.3 lib/platform_specific/opal/extensions/geolocation.rb
atome-0.5.6.0.2 lib/platform_specific/opal/extensions/geolocation.rb
atome-0.5.5.9.1 lib/platform_specific/opal/extensions/geolocation.rb
atome-0.5.5.8.7 lib/platform_specific/opal/extensions/geolocation.rb