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.7.7 lib/platform_specific/opal/extensions/geolocation.rb
atome-0.5.6.7.6 lib/platform_specific/opal/extensions/geolocation.rb
atome-0.5.6.7.5 lib/platform_specific/opal/extensions/geolocation.rb
atome-0.5.6.7.4 lib/platform_specific/opal/extensions/geolocation.rb
atome-0.5.6.7.3 lib/platform_specific/opal/extensions/geolocation.rb
atome-0.5.6.6.9 lib/platform_specific/opal/extensions/geolocation.rb
atome-0.5.6.6.7 lib/platform_specific/opal/extensions/geolocation.rb
atome-0.5.6.6.5 lib/platform_specific/opal/extensions/geolocation.rb
atome-0.5.6.6.1 lib/platform_specific/opal/extensions/geolocation.rb
atome-0.5.6.6.0 lib/platform_specific/opal/extensions/geolocation.rb
atome-0.5.6.5.7 lib/platform_specific/opal/extensions/geolocation.rb
atome-0.5.6.5.6 lib/platform_specific/opal/extensions/geolocation.rb
atome-0.5.6.5.4 lib/platform_specific/opal/extensions/geolocation.rb
atome-0.5.6.5.1 lib/platform_specific/opal/extensions/geolocation.rb
atome-0.5.6.4.8 lib/platform_specific/opal/extensions/geolocation.rb
atome-0.5.6.4.5 lib/platform_specific/opal/extensions/geolocation.rb
atome-0.5.6.4.2 lib/platform_specific/opal/extensions/geolocation.rb
atome-0.5.6.4.1 lib/platform_specific/opal/extensions/geolocation.rb
atome-0.5.6.4.0 lib/platform_specific/opal/extensions/geolocation.rb
atome-0.5.6.3.9 lib/platform_specific/opal/extensions/geolocation.rb