Skip to content

Latest commit

 

History

History
53 lines (36 loc) · 1.34 KB

README.md

File metadata and controls

53 lines (36 loc) · 1.34 KB

LocationManager

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.

Example

Properties

  • 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

Functions

  • 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)

Events

  • onLocationChange (data {latitude, longitude})
  • onLocationError (message <string>)
locManager.onLocationChange (data) ->
	latitude = data.latitude
	longitude = data.longitude

locManager.onLocationError (message) ->
	print message