Useful location data for Framer prototypes. Find out where the user is located and get distance and heading to other locations.
Note: Location data is not available in Framer Studio so use a browser window for testing.
enabled
<bool>latitude
<number> readonly (90 to -90 degrees)longitude
<number> readonly (180 to -180 degrees)errorMessage
<string or null> readonly
# Include the LocationManager
{LocationManager} = require "LocationManager"
locManager = new LocationManager
- LocationManager.
available()
returns <bool> (whether current device supports location data) distanceTo(destinationCoordinates)
returns <number> (meters)headingTo(destinationCoordinates)
returns <number> (degrees)
NY =
latitude: 40.748817
longitude: -73.985428
distanceToNY = locManager.distanceTo(NY)
headingToNY = locManager.headingTo(NY)
onLocationChange
(data {latitude, longitude})onLocationError
(message <string>)
locManager.onLocationChange (data) ->
latitude = data.latitude
longitude = data.longitude
locManager.onLocationError (message) ->
print message